]> code.delx.au - gnu-emacs/blobdiff - lisp/kmacro.el
* net/tramp.el (tramp-completion-file-name-handler-alist)
[gnu-emacs] / lisp / kmacro.el
index 3f4ff73177f0c3c3523f62fcaa74bf873de8432b..4566d4c32c32c4cb0c7db36d8e315a73bca1f542 100644 (file)
@@ -1,6 +1,6 @@
 ;;; kmacro.el --- enhanced keyboard macros
 
-;; Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard convenience
@@ -19,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
   "Simplified keyboard macro user interface."
   :group 'keyboard
   :group 'convenience
-  :version "21.4"
+  :version "22.1"
   :link '(emacs-commentary-link :tag "Commentary" "kmacro.el")
   :link '(emacs-library-link :tag "Lisp File" "kmacro.el"))
 
@@ -614,10 +614,13 @@ With numeric arg, repeat macro now that many times,
 counting the definition just completed as the first repetition.
 An argument of zero means repeat until error."
   (interactive "P")
-  (end-kbd-macro arg #'kmacro-loop-setup-function)
-  (when (and last-kbd-macro (= (length last-kbd-macro) 0))
-    (message "Ignore empty macro")
-    (kmacro-pop-ring)))
+   ;; Isearch may push the kmacro-end-macro key sequence onto the macro.
+   ;; Just ignore it when executing the macro.
+  (unless executing-kbd-macro
+    (end-kbd-macro arg #'kmacro-loop-setup-function)
+    (when (and last-kbd-macro (= (length last-kbd-macro) 0))
+      (message "Ignore empty macro")
+      (kmacro-pop-ring))))
 
 
 ;;;###autoload
@@ -628,7 +631,7 @@ A prefix argument serves as a repeat count.  Zero means repeat until error.
 When you call the macro, you can call the macro again by repeating
 just the last key in the key sequence that you used to call this
 command.  See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg'
-for details on how to adjust or disable this behaviour.
+for details on how to adjust or disable this behavior.
 
 To make a macro permanent so you can call it even after defining
 others, use \\[kmacro-name-last-macro]."
@@ -957,9 +960,9 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
 (defun kmacro-step-edit-prompt (macro index)
   ;; Show step-edit prompt
   (let ((keys (and (not kmacro-step-edit-appending)
-                  index (substring macro index executing-macro-index)))
+                  index (substring macro index executing-kbd-macro-index)))
        (future (and (not kmacro-step-edit-appending)
-                    (substring macro executing-macro-index)))
+                    (substring macro executing-kbd-macro-index)))
        (message-log-max nil)
        (curmsg (current-message)))
 
@@ -1017,12 +1020,12 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
           (not (eq kmacro-step-edit-action t)))
       ;; Find the actual end of this key sequence.
       ;; Must be able to backtrack in case we actually execute it.
-      (setq restore-index executing-macro-index)
+      (setq restore-index executing-kbd-macro-index)
       (let (unread-command-events)
        (quoted-insert 0)
        (when unread-command-events
-         (setq executing-macro-index (- executing-macro-index (length unread-command-events))
-               next-index executing-macro-index)))))
+         (setq executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events))
+               next-index executing-kbd-macro-index)))))
 
     ;; Query the user; stop macro exection temporarily
     (let ((macro executing-kbd-macro)
@@ -1042,7 +1045,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
            (when unread-command-events
              (setq kmacro-step-edit-new-macro
                    (substring kmacro-step-edit-new-macro 0 (- (length unread-command-events)))
-                   executing-macro-index (- executing-macro-index (length unread-command-events)))))
+                   executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events)))))
          (setq current-prefix-arg nil
                prefix-arg nil)
          (setq act 'ignore))
@@ -1096,24 +1099,24 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
        (setq act t)
        t)
        ((member act '(insert-1 insert))
-       (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
+       (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
        (setq kmacro-step-edit-inserting (if (eq act 'insert-1) 1 t))
        nil)
        ((member act '(replace-1 replace))
        (setq kmacro-step-edit-inserting (if (eq act 'replace-1) 1 t))
        (setq kmacro-step-edit-prefix-index nil)
-       (if (= executing-macro-index (length executing-kbd-macro))
+       (if (= executing-kbd-macro-index (length executing-kbd-macro))
            (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
                  kmacro-step-edit-appending t))
        nil)
        ((eq act 'append)
        (setq kmacro-step-edit-inserting t)
-       (if (= executing-macro-index (length executing-kbd-macro))
+       (if (= executing-kbd-macro-index (length executing-kbd-macro))
            (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
                  kmacro-step-edit-appending t))
        t)
        ((eq act 'append-end)
-       (if (= executing-macro-index (length executing-kbd-macro))
+       (if (= executing-kbd-macro-index (length executing-kbd-macro))
            (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
                  kmacro-step-edit-inserting t
                  kmacro-step-edit-appending t)
@@ -1121,21 +1124,21 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
        (setq act t)
        t)
        ((eq act 'help)
-       (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
+       (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
        (setq kmacro-step-edit-help (not kmacro-step-edit-help))
        nil)
        (t ;; Ignore unknown responses
-       (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
+       (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
        nil))
-      (if (> executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
+      (if (> executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index))
          (setq kmacro-step-edit-new-macro
                (vconcat kmacro-step-edit-new-macro
                         (substring executing-kbd-macro
                                    (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)
-                                   (if (eq act t) nil executing-macro-index)))
+                                   (if (eq act t) nil executing-kbd-macro-index)))
                kmacro-step-edit-prefix-index nil))
       (if restore-index
-         (setq executing-macro-index restore-index)))
+         (setq executing-kbd-macro-index restore-index)))
      (t
       (setq this-command 'ignore)))
     (setq kmacro-step-edit-key-index next-index)))
@@ -1148,7 +1151,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
        (executing-kbd-macro nil)
        (defining-kbd-macro nil)
        cmd keys next-index)
-    (setq executing-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)
+    (setq executing-kbd-macro-index (or kmacro-step-edit-prefix-index kmacro-step-edit-key-index)
          kmacro-step-edit-prefix-index nil)
     (kmacro-step-edit-prompt macro nil)
     ;; Now, we have read a key sequence from the macro, but we don't want
@@ -1169,8 +1172,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
            (setq kmacro-step-edit-inserting nil)
            (when unread-command-events
              (setq keys (substring keys 0 (- (length unread-command-events)))
-                   executing-macro-index (- executing-macro-index (length unread-command-events))
-                   next-index executing-macro-index
+                   executing-kbd-macro-index (- executing-kbd-macro-index (length unread-command-events))
+                   next-index executing-kbd-macro-index
                    unread-command-events nil)))
          (setq cmd 'ignore)
          nil)
@@ -1214,7 +1217,7 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
      ((eq kmacro-step-edit-active 'ignore)
       (setq this-command 'ignore))
      ((eq kmacro-step-edit-active 'append-end)
-      (if (= executing-macro-index (length executing-kbd-macro))
+      (if (= executing-kbd-macro-index (length executing-kbd-macro))
          (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
                kmacro-step-edit-inserting t
                kmacro-step-edit-appending t
@@ -1240,8 +1243,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
   (when kmacro-step-edit-active
     (add-hook 'pre-command-hook 'kmacro-step-edit-pre-command nil nil)
     (if kmacro-step-edit-key-index
-       (setq executing-macro-index kmacro-step-edit-key-index)
-      (setq kmacro-step-edit-key-index executing-macro-index))))
+       (setq executing-kbd-macro-index kmacro-step-edit-key-index)
+      (setq kmacro-step-edit-key-index executing-kbd-macro-index))))
 
 
 (defun kmacro-step-edit-macro ()