diff options
| author | Stefan Monnier | 2013-08-28 17:19:54 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-08-28 17:19:54 -0400 |
| commit | f663baa7dd99e6ea45120175d5ecd3514c7e33bc (patch) | |
| tree | 6d222b657b5ac536e20a9a5a8b7fb0817c4073fa | |
| parent | dd4f8b743d6c3f5f59e5afeca813c13619a0a771 (diff) | |
| download | emacs-f663baa7dd99e6ea45120175d5ecd3514c7e33bc.tar.gz emacs-f663baa7dd99e6ea45120175d5ecd3514c7e33bc.zip | |
* lisp/simple.el (repeat-complex-command--called-interactively-skip):
New function.
(repeat-complex-command): Use it.
Fixes: debbugs:14136
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb802db3b1b..690aca9540f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2013-08-28 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2013-08-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * simple.el (repeat-complex-command--called-interactively-skip): | ||
| 4 | New function. | ||
| 5 | (repeat-complex-command): Use it (bug#14136). | ||
| 6 | |||
| 3 | * progmodes/cc-mode.el: Minor cleanup of var declarations. | 7 | * progmodes/cc-mode.el: Minor cleanup of var declarations. |
| 4 | (c-define-abbrev-table): Add `doc' argument. | 8 | (c-define-abbrev-table): Add `doc' argument. |
| 5 | (c-mode-abbrev-table, c++-mode-abbrev-table) | 9 | (c-mode-abbrev-table, c++-mode-abbrev-table) |
diff --git a/lisp/simple.el b/lisp/simple.el index 6825c41becc..c5e5b313b7b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1404,11 +1404,25 @@ to get different commands to edit and resubmit." | |||
| 1404 | ;; add it to the history. | 1404 | ;; add it to the history. |
| 1405 | (or (equal newcmd (car command-history)) | 1405 | (or (equal newcmd (car command-history)) |
| 1406 | (setq command-history (cons newcmd command-history))) | 1406 | (setq command-history (cons newcmd command-history))) |
| 1407 | (eval newcmd)) | 1407 | (unwind-protect |
| 1408 | (progn | ||
| 1409 | ;; Trick called-interactively-p into thinking that `newcmd' is | ||
| 1410 | ;; an interactive call (bug#14136). | ||
| 1411 | (add-hook 'called-interactively-p-functions | ||
| 1412 | #'repeat-complex-command--called-interactively-skip) | ||
| 1413 | (eval newcmd)) | ||
| 1414 | (remove-hook 'called-interactively-p-functions | ||
| 1415 | #'repeat-complex-command--called-interactively-skip))) | ||
| 1408 | (if command-history | 1416 | (if command-history |
| 1409 | (error "Argument %d is beyond length of command history" arg) | 1417 | (error "Argument %d is beyond length of command history" arg) |
| 1410 | (error "There are no previous complex commands to repeat"))))) | 1418 | (error "There are no previous complex commands to repeat"))))) |
| 1411 | 1419 | ||
| 1420 | (defun repeat-complex-command--called-interactively-skip (i _frame1 frame2) | ||
| 1421 | (and (eq 'eval (cadr frame2)) | ||
| 1422 | (eq 'repeat-complex-command | ||
| 1423 | (cadr (backtrace-frame i #'called-interactively-p))) | ||
| 1424 | 1)) | ||
| 1425 | |||
| 1412 | (defvar extended-command-history nil) | 1426 | (defvar extended-command-history nil) |
| 1413 | 1427 | ||
| 1414 | (defun read-extended-command () | 1428 | (defun read-extended-command () |