diff options
| author | Stefan Monnier | 2013-02-20 11:37:06 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-02-20 11:37:06 -0500 |
| commit | b6c2bfff02239197fc855c0575def855afab01c7 (patch) | |
| tree | d5e7870aeaa28b3bbeb3bdb77b0bcac886b939cc /lisp | |
| parent | 5079cfefc0fe7152bae4ea175f5679bca42e0cbd (diff) | |
| download | emacs-b6c2bfff02239197fc855c0575def855afab01c7.tar.gz emacs-b6c2bfff02239197fc855c0575def855afab01c7.zip | |
* lisp/simple.el (command-execute): Move from C. Add obsolete check.
(extended-command-history): Move from C.
* src/keyboard.c (Qcommand_execute): New var.
(command_loop_1, read_char): Use it.
(Fcommand_execute): Remove, replace by an Elisp implementation.
(syms_of_keyboard): Adjust accordingly.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 49 |
2 files changed, 54 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a1e93ac19c..abcf6578060 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-02-20 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * simple.el (command-execute): Move from C. Add obsolete check. | ||
| 4 | (extended-command-history): Move from C. | ||
| 5 | |||
| 1 | 2013-02-20 Ulrich Müller <ulm@gentoo.org> | 6 | 2013-02-20 Ulrich Müller <ulm@gentoo.org> |
| 2 | 7 | ||
| 3 | * jka-cmpr-hook.el (jka-compr-compression-info-list) | 8 | * jka-cmpr-hook.el (jka-compr-compression-info-list) |
diff --git a/lisp/simple.el b/lisp/simple.el index 138c2420309..3ef700a6058 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1400,6 +1400,8 @@ to get different commands to edit and resubmit." | |||
| 1400 | (error "Argument %d is beyond length of command history" arg) | 1400 | (error "Argument %d is beyond length of command history" arg) |
| 1401 | (error "There are no previous complex commands to repeat"))))) | 1401 | (error "There are no previous complex commands to repeat"))))) |
| 1402 | 1402 | ||
| 1403 | (defvar extended-command-history nil) | ||
| 1404 | |||
| 1403 | (defun read-extended-command () | 1405 | (defun read-extended-command () |
| 1404 | "Read command name to invoke in `execute-extended-command'." | 1406 | "Read command name to invoke in `execute-extended-command'." |
| 1405 | (minibuffer-with-setup-hook | 1407 | (minibuffer-with-setup-hook |
| @@ -1489,6 +1491,53 @@ give to the command you invoke, if it asks for an argument." | |||
| 1489 | (sit-for (if (numberp suggest-key-bindings) | 1491 | (sit-for (if (numberp suggest-key-bindings) |
| 1490 | suggest-key-bindings | 1492 | suggest-key-bindings |
| 1491 | 2)))))))) | 1493 | 2)))))))) |
| 1494 | |||
| 1495 | (defun command-execute (cmd &optional record-flag keys special) | ||
| 1496 | ;; BEWARE: Called directly from the C code. | ||
| 1497 | "Execute CMD as an editor command. | ||
| 1498 | CMD must be a symbol that satisfies the `commandp' predicate. | ||
| 1499 | Optional second arg RECORD-FLAG non-nil | ||
| 1500 | means unconditionally put this command in the variable `command-history'. | ||
| 1501 | Otherwise, that is done only if an arg is read using the minibuffer. | ||
| 1502 | The argument KEYS specifies the value to use instead of (this-command-keys) | ||
| 1503 | when reading the arguments; if it is nil, (this-command-keys) is used. | ||
| 1504 | The argument SPECIAL, if non-nil, means that this command is executing | ||
| 1505 | a special event, so ignore the prefix argument and don't clear it." | ||
| 1506 | (setq debug-on-next-call nil) | ||
| 1507 | (let ((prefixarg (unless special | ||
| 1508 | (prog1 prefix-arg | ||
| 1509 | (setq current-prefix-arg prefix-arg) | ||
| 1510 | (setq prefix-arg nil))))) | ||
| 1511 | (and (symbolp cmd) | ||
| 1512 | (get cmd 'disabled) | ||
| 1513 | ;; FIXME: Weird calling convention! | ||
| 1514 | (run-hooks 'disabled-command-function)) | ||
| 1515 | (let ((final cmd)) | ||
| 1516 | (while | ||
| 1517 | (progn | ||
| 1518 | (setq final (indirect-function final)) | ||
| 1519 | (if (autoloadp final) | ||
| 1520 | (setq final (autoload-do-load final cmd))))) | ||
| 1521 | (cond | ||
| 1522 | ((arrayp final) | ||
| 1523 | ;; If requested, place the macro in the command history. For | ||
| 1524 | ;; other sorts of commands, call-interactively takes care of this. | ||
| 1525 | (when record-flag | ||
| 1526 | (push `(execute-kbd-macro ,final ,prefixarg) command-history) | ||
| 1527 | ;; Don't keep command history around forever. | ||
| 1528 | (when (and (numberp history-length) (> history-length 0)) | ||
| 1529 | (let ((cell (nthcdr history-length command-history))) | ||
| 1530 | (if (consp cell) (setcdr cell nil))))) | ||
| 1531 | (execute-kbd-macro final prefixarg)) | ||
| 1532 | (t | ||
| 1533 | ;; Pass `cmd' rather than `final', for the backtrace's sake. | ||
| 1534 | (prog1 (call-interactively cmd record-flag keys) | ||
| 1535 | (when (and (symbolp cmd) | ||
| 1536 | (get cmd 'byte-obsolete-info) | ||
| 1537 | (not (get cmd 'command-execute-obsolete-warned))) | ||
| 1538 | (put cmd 'command-execute-obsolete-warned t) | ||
| 1539 | (message "%s" (macroexp--obsolete-warning | ||
| 1540 | cmd (get cmd 'byte-obsolete-info) "command"))))))))) | ||
| 1492 | 1541 | ||
| 1493 | (defvar minibuffer-history nil | 1542 | (defvar minibuffer-history nil |
| 1494 | "Default minibuffer history list. | 1543 | "Default minibuffer history list. |