summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorNicolas Richard <theonewiththeevillook@yahoo.fr>2014-04-01 23:51:59 -0700
committerGlenn Morris <rgm@gnu.org>2014-04-01 23:51:59 -0700
commit6116a72722a51dbcdf2dd467e35683a386aa5f60 (patch)
treea6f6155211a242e827d354681f7e382c953b123a /lisp
parent8ec45bab98ad308c630801146eb85488800a4246 (diff)
downloademacs-6116a72722a51dbcdf2dd467e35683a386aa5f60.tar.gz
Fix for command-execute handling of disabled commands
* lisp/simple.el (command-execute): Do not execute the command when it is disabled; fixes thinko in 2013-02-20 conversion from C. Fixes: debbugs:17151
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/simple.el60
2 files changed, 35 insertions, 30 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 381aeda8cb4..9d474f3f27f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-01 Nicolas Richard <theonewiththeevillook@yahoo.fr>
+
+ * simple.el (command-execute): Do not execute the command when it
+ is disabled; fixes thinko in 2013-02-20 conversion from C. (Bug#17151)
+
2014-03-29 Juri Linkov <juri@jurta.org>
* dired-aux.el (dired-compress-file): Don't use string-match-p
diff --git a/lisp/simple.el b/lisp/simple.el
index 98604a44de5..10a3a98973d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1628,36 +1628,36 @@ a special event, so ignore the prefix argument and don't clear it."
(prog1 prefix-arg
(setq current-prefix-arg prefix-arg)
(setq prefix-arg nil)))))
- (and (symbolp cmd)
- (get cmd 'disabled)
- ;; FIXME: Weird calling convention!
- (run-hooks 'disabled-command-function))
- (let ((final cmd))
- (while
- (progn
- (setq final (indirect-function final))
- (if (autoloadp final)
- (setq final (autoload-do-load final cmd)))))
- (cond
- ((arrayp final)
- ;; If requested, place the macro in the command history. For
- ;; other sorts of commands, call-interactively takes care of this.
- (when record-flag
- (push `(execute-kbd-macro ,final ,prefixarg) command-history)
- ;; Don't keep command history around forever.
- (when (and (numberp history-length) (> history-length 0))
- (let ((cell (nthcdr history-length command-history)))
- (if (consp cell) (setcdr cell nil)))))
- (execute-kbd-macro final prefixarg))
- (t
- ;; Pass `cmd' rather than `final', for the backtrace's sake.
- (prog1 (call-interactively cmd record-flag keys)
- (when (and (symbolp cmd)
- (get cmd 'byte-obsolete-info)
- (not (get cmd 'command-execute-obsolete-warned)))
- (put cmd 'command-execute-obsolete-warned t)
- (message "%s" (macroexp--obsolete-warning
- cmd (get cmd 'byte-obsolete-info) "command")))))))))
+ (if (and (symbolp cmd)
+ (get cmd 'disabled))
+ ;; FIXME: Weird calling convention!
+ (run-hooks 'disabled-command-function)
+ (let ((final cmd))
+ (while
+ (progn
+ (setq final (indirect-function final))
+ (if (autoloadp final)
+ (setq final (autoload-do-load final cmd)))))
+ (cond
+ ((arrayp final)
+ ;; If requested, place the macro in the command history. For
+ ;; other sorts of commands, call-interactively takes care of this.
+ (when record-flag
+ (push `(execute-kbd-macro ,final ,prefixarg) command-history)
+ ;; Don't keep command history around forever.
+ (when (and (numberp history-length) (> history-length 0))
+ (let ((cell (nthcdr history-length command-history)))
+ (if (consp cell) (setcdr cell nil)))))
+ (execute-kbd-macro final prefixarg))
+ (t
+ ;; Pass `cmd' rather than `final', for the backtrace's sake.
+ (prog1 (call-interactively cmd record-flag keys)
+ (when (and (symbolp cmd)
+ (get cmd 'byte-obsolete-info)
+ (not (get cmd 'command-execute-obsolete-warned)))
+ (put cmd 'command-execute-obsolete-warned t)
+ (message "%s" (macroexp--obsolete-warning
+ cmd (get cmd 'byte-obsolete-info) "command"))))))))))
(defvar minibuffer-history nil
"Default minibuffer history list.