]> code.delx.au - gnu-emacs-elpa/commitdiff
Avoid error in case this-command isn't a symbol.
authorNoam Postavsky <npostavs@users.sourceforge.net>
Fri, 26 Feb 2016 21:59:39 +0000 (16:59 -0500)
committerNoam Postavsky <npostavs@users.sourceforge.net>
Fri, 26 Feb 2016 21:59:39 +0000 (16:59 -0500)
Fixes #664.

* yasnippet.el (yas--skip-and-clear-field-p): Only get
  `delete-selection' property of `this-command' when it's a symbol.

yasnippet.el

index 69d6b26ab7ff993255c7278b0fbb8796723cc886..b68389fd6c175c63b43f463a0c8002cd339f44eb 100644 (file)
@@ -3390,9 +3390,9 @@ BEG, END and LENGTH like overlay modification hooks."
        (= (point) (yas--field-start field))
        (require 'delsel)
        ;; `yank' sets `this-command' to t during execution.
-       (let ((clearp (get (if (commandp this-command) this-command
-                            this-original-command)
-                          'delete-selection)))
+       (let* ((command (if (commandp this-command) this-command
+                         this-original-command))
+              (clearp (if (symbolp command) (get command 'delete-selection))))
          (when (and (not (memq clearp '(yank supersede kill)))
                     (functionp clearp))
            (setq clearp (funcall clearp)))