Anonymous committed c16de9a

Don't use #'multiple-value-bind on lists, mmm-mode.el

  • Participants
  • Parent commits 3818594

Comments (0)

Files changed (2)

+2009-08-13  Aidan Kehoe  <>
+	* mmm-cmds.el:
+	* mmm-cmds.el (mmm-destructuring-bind): New.
+	Macro that corresponds to `destructuring-bind', but that does not
+	error if the structures do not match. 
+	* mmm-cmds.el (mmm-insert-by-key):
+	Use it, instead of `multiple-value-bind', to avoid unwanted
+	interactions with actual working multiple-value implementations. 
 2008-12-27  Norbert Koch  <>
 	* Makefile (VERSION): XEmacs package 1.03 released.
       "Execute `body'."
       `(progn ,@body))))
+(defmacro mmm-destructuring-bind (args expr &rest body)
+  "Like `destructuring-bind', but don't error if ARGS don't fit EXPR."
+  `(loop for ,args = ,expr return (progn ,@body)))
 ;;{{{ Applying Predefined Classes
 symbols such as shift, control, etc. and BASIC-KEY is a character code
 or a symbol such as tab, return, etc. Note that if there are no
 MODIFIERS, the dotted list becomes simply BASIC-KEY."
-  (multiple-value-bind (class skel str) (mmm-get-insertion-spec key)
+  (mmm-destructuring-bind (class skel str) (mmm-get-insertion-spec key)
     (when skel
       (let ((after-change-functions nil)
             (old-undo buffer-undo-list) undo)
         ;; have to do it.
         (if mmm-xemacs (setq skeleton-positions nil))
         (skeleton-proxy-new skel str arg)
-        (destructuring-bind (back end beg front) skeleton-positions
+        (mmm-destructuring-bind (back end beg front) skeleton-positions
           ;; TODO: Find a way to trap invalid-parent signals from
           ;; make-region and undo the skeleton insertion.
           (let ((match-submode (plist-get class :match-submode))