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)
;; 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 ()