Anonymous avatar Anonymous committed c16de9a

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

Comments (0)

Files changed (2)

+2009-08-13  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* 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  <viteno@xemacs.org>
 
 	* 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 CLASSES
 ;;{{{ 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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.