* lisp/simple.el (repeat-complex-command--called-interactively-skip):

New function.
(repeat-complex-command): Use it.

Fixes: debbugs:14136
This commit is contained in:
Stefan Monnier 2013-08-28 17:19:54 -04:00
parent dd4f8b743d
commit f663baa7dd
2 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2013-08-28 Stefan Monnier <monnier@iro.umontreal.ca>
* simple.el (repeat-complex-command--called-interactively-skip):
New function.
(repeat-complex-command): Use it (bug#14136).
* progmodes/cc-mode.el: Minor cleanup of var declarations.
(c-define-abbrev-table): Add `doc' argument.
(c-mode-abbrev-table, c++-mode-abbrev-table)

View file

@ -1404,11 +1404,25 @@ to get different commands to edit and resubmit."
;; add it to the history.
(or (equal newcmd (car command-history))
(setq command-history (cons newcmd command-history)))
(eval newcmd))
(unwind-protect
(progn
;; Trick called-interactively-p into thinking that `newcmd' is
;; an interactive call (bug#14136).
(add-hook 'called-interactively-p-functions
#'repeat-complex-command--called-interactively-skip)
(eval newcmd))
(remove-hook 'called-interactively-p-functions
#'repeat-complex-command--called-interactively-skip)))
(if command-history
(error "Argument %d is beyond length of command history" arg)
(error "There are no previous complex commands to repeat")))))
(defun repeat-complex-command--called-interactively-skip (i _frame1 frame2)
(and (eq 'eval (cadr frame2))
(eq 'repeat-complex-command
(cadr (backtrace-frame i #'called-interactively-p)))
1))
(defvar extended-command-history nil)
(defun read-extended-command ()