emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114052: * lisp/simple.el (repeat-complex-command--c


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114052: * lisp/simple.el (repeat-complex-command--called-interactively-skip):
Date: Wed, 28 Aug 2013 21:19:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114052
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14136
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-28 17:19:54 -0400
message:
  * lisp/simple.el (repeat-complex-command--called-interactively-skip):
  New function.
  (repeat-complex-command): Use it.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/simple.el                 simple.el-20091113204419-o5vbwnq5f7feedwu-403
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-28 20:24:18 +0000
+++ b/lisp/ChangeLog    2013-08-28 21:19:54 +0000
@@ -1,5 +1,9 @@
 2013-08-28  Stefan Monnier  <address@hidden>
 
+       * 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)

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2013-08-16 08:27:49 +0000
+++ b/lisp/simple.el    2013-08-28 21:19:54 +0000
@@ -1404,11 +1404,25 @@
          ;; 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 ()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]