annotate lisp/kmacro.el @ 46370:40db0673e6f0

Most uses of XSTRING combined with STRING_BYTES or indirection changed to SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references left unchanged for now.
author Ken Raeburn <raeburn@raeburn.org>
date Mon, 15 Jul 2002 00:00:41 +0000
parents d441fc235798
children 7e8358ec31ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
1 ;;; kmacro.el --- enhanced keyboard macros
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
2
46085
33538dc6ac79 Fixed copyright and keywords.
Kim F. Storm <storm@cua.dk>
parents: 46083
diff changeset
3 ;; Copyright (C) 2002 Free Software Foundation, Inc.
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
4
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
5 ;; Author: Kim F. Storm <storm@cua.dk>
46085
33538dc6ac79 Fixed copyright and keywords.
Kim F. Storm <storm@cua.dk>
parents: 46083
diff changeset
6 ;; Keywords: keyboard convenience
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
7
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
9
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
13 ;; any later version.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
14
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
18 ;; GNU General Public License for more details.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
19
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
24
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
25 ;;; Commentary:
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
26
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
27 ;; The kmacro package is an alternative user interface to emacs'
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
28 ;; keyboard macro functionality. This functionality is normally bound
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
29 ;; to C-x (, C-x ), and C-x e, but these bindings are too hard to
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
30 ;; type to be really useful for doing small repeated tasks.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
31
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
32 ;; With kmacro, two function keys are dedicated to keyboard macros,
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
33 ;; by default F7 and F8. Personally, I prefer F1 and F2, but those
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
34 ;; keys already have default bindings.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
35 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
36 ;; To start defining a keyboard macro, use F7. To end the macro,
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
37 ;; use F8, and to call the macro also use F8. This makes it very
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
38 ;; easy to repeat a macro immediately after defining it.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
39 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
40 ;; You can call the macro repeatedly by pressing F8 multiple times, or
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
41 ;; you can give a numeric prefix argument specifying the number of
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
42 ;; times to repeat the macro. Macro execution automatically
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
43 ;; terminates when point reaches the end of the buffer or if an error
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
44 ;; is signalled by ringing the bell.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
45
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
46 ;; If you enter F7 while defining the macro, the numeric value of
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
47 ;; `kmacro-counter' is inserted using the `kmacro-counter-format', and
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
48 ;; `kmacro-counter' is incremented by 1 (or the numeric prefix value
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
49 ;; of F7).
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
50 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
51 ;; The initial value of `kmacro-counter' is 0, or the numeric prefix
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
52 ;; value given to F7 when starting the macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
53 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
54 ;; Now, each time you call the macro using F8, the current
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
55 ;; value of `kmacro-counter' is inserted and incremented, making it
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
56 ;; easy to insert incremental numbers in the buffer.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
57 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
58 ;; Example:
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
59 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
60 ;; The following sequence: M-5 F7 x M-2 F7 y F8 F8 F8 F8
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
61 ;; inserts the following string: x5yx7yx9yx11y
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
62
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
63 ;; A macro can also be called using a mouse click, default S-mouse-3.
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
64 ;; This calls the macro at the point where you click the mouse.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
65
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
66 ;; When you have defined another macro, which is thus called via F8,
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
67 ;; the previous macro is pushed onto a keyboard macro ring. The head
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
68 ;; macro on the ring can be executed using S-F8. You can cycle the
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
69 ;; macro ring using C-F8. You can also swap the last macro and the
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
70 ;; head of the macro ring using C-u F8.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
71
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
72 ;; You can edit the last macro using M-F7.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
73
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
74 ;; You can append to the last macro using C-u F7.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
75
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
76 ;; You can set the macro counter using C-F7, and you can set
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
77 ;; the macro counter format with S-F7..
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
78
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
79 ;; The following key bindings are performed:
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
80 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
81 ;; Normal While defining macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
82 ;; --------------------------- ------------------------------
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
83 ;; f7 Define macro Insert current counter value
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
84 ;; Prefix arg specifies initial and increase counter by prefix
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
85 ;; counter value (default 0) (default increment: 1)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
86 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
87 ;; C-u f7 APPENDs to last macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
88 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
89 ;; f8 Call last macro End macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
90 ;; Prefix arg specifies number
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
91 ;; of times to execute macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
92 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
93 ;; C-u f8 Swap last and head of macro ring.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
94 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
95 ;; S-f7 Set the format of the macro Ditto, but notice that the
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
96 ;; counter (default: %d). format is reset at the next
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
97 ;; invocation of the macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
98 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
99 ;; C-f7 Set the macro counter value Increase/decrease counter value
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
100 ;; to the prefix value. by the prefix value, or if prefix
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
101 ;; is C-u, set counter to 0.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
102 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
103 ;; M-f7 Edit the last macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
104 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
105 ;; S-f8 Call the previous macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
106 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
107 ;; C-f8 Cycle the macro ring.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
108 ;;
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
109 ;; S-mouse-3 Set point at click and End macro and execute macro at
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
110 ;; execute last macro. click.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
111
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
112 ;;; Code:
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
113
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
114 ;; Customization:
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
115
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
116 (defgroup kmacro nil
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
117 "Simplified keyboard macro user interface."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
118 :group 'keyboard
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
119 :group 'convenience
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
120 :link '(emacs-commentary-link :tag "Commentary" "kmacro.el")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
121 :link '(emacs-library-link :tag "Lisp File" "kmacro.el"))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
122
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
123 ;;;###autoload
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
124 (defcustom kmacro-initialize nil
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
125 "Setting this variable turns on the kmacro functionality.
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
126 This binds the kmacro function keys in the `global-map', so
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
127 unsetting this variable does not have any effect!"
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
128 :set #'(lambda (symbol value)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
129 (if value (kmacro-initialize))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
130 (set symbol value))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
131 :initialize 'custom-initialize-default
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
132 :require 'kmacro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
133 :link '(emacs-commentary-link "kmacro.el")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
134 :set-after '(kmacro-start-key kmacro-call-key kmacro-mouse-button)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
135 :version "21.4"
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
136 :type 'boolean
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
137 :group 'kmacro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
138
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
139 (defcustom kmacro-start-key 'f7
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
140 "The function key used by kmacro to start a macro."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
141 :type 'symbol
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
142 :group 'kmacro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
143
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
144 (defcustom kmacro-call-key 'f8
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
145 "The function key used by kmacro to end and call a macro."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
146 :type 'symbol
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
147 :group 'kmacro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
148
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
149 (defcustom kmacro-call-mouse-event 'S-mouse-3
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
150 "The mouse event used by kmacro to call a macro."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
151 :type 'symbol
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
152 :group 'kmacro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
153
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
154 ;; State variables
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
155
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
156 (defvar kmacro-counter 0
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
157 "*Current keyboard macro counter.")
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
158
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
159 (defvar kmacro-counter-format "%d"
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
160 "*Current keyboard macro counter format.")
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
161
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
162 (defvar kmacro-counter-format-start kmacro-counter-format
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
163 "Macro format at start of macro execution.")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
164
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
165 (defvar kmacro-last-counter 0 "Last counter inserted by key macro.")
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
166 (defvar kmacro-append-to nil "Last key macro if appending to macro.")
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
167 (defvar kmacro-ring nil "Key macro ring.")
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
168
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
169 (defvar kmacro-ring-max 4
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
170 "*Maximum number of key macros to save in key macro ring.")
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
171
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
172 (defun kmacro-display (macro)
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
173 "Display a keyboard MACRO."
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
174 (let (s)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
175 (if (stringp macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
176 (setq s (if (> (length macro) 50)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
177 (concat (substring macro 0 50) "...")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
178 macro))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
179 (if (vectorp macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
180 (let (v (i 0) (n (length macro)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
181 (setq s "")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
182 (while (and (< i n) (< (length s) 50))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
183 (setq v (aref macro i))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
184 (setq s (cond
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
185 ((numberp v) (concat s (char-to-string v)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
186 ((stringp v) (concat s v))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
187 ((symbolp v) (concat s "[" (symbol-name v) "]"))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
188 (t s)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
189 (setq i (1+ i)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
190 (if (< i n)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
191 (setq s (concat s "..."))))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
192 (message (format "Macro: %s" s))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
193
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
194
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
195 (defun kmacro-start-macro (arg)
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
196 "Set `kmacro-counter' to ARG or 0 if missing, and `start-kbd-macro'.
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
197 With \\[universal-argument], append to current keyboard macro (keep kmacro-counter).
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
198
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
199 When defining/executing macro, insert macro counter and increment with
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
200 ARG or 1 if missing.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
201 With \\[universal-argument], insert previous kmacro-counter (but do not modify counter).
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
202
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
203 The macro counter can be modified via \\[kmacro-set-counter].
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
204 The format of the counter can be modified via \\[kmacro-set-format]."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
205 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
206 (if (or defining-kbd-macro executing-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
207 (if (and current-prefix-arg (listp current-prefix-arg))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
208 (insert (format kmacro-counter-format kmacro-last-counter))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
209 (insert (format kmacro-counter-format kmacro-counter))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
210 (setq kmacro-last-counter kmacro-counter
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
211 kmacro-counter (+ kmacro-counter arg)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
212 (if (and current-prefix-arg (listp current-prefix-arg))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
213 (setq kmacro-append-to last-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
214 (setq kmacro-append-to nil
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
215 kmacro-counter (if current-prefix-arg arg 0)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
216 kmacro-last-counter kmacro-counter))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
217 (if last-kbd-macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
218 (let ((len (length kmacro-ring)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
219 (setq kmacro-ring (cons last-kbd-macro kmacro-ring))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
220 (if (>= len kmacro-ring-max)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
221 (setcdr (nthcdr len kmacro-ring) nil))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
222 (setq kmacro-counter-format-start kmacro-counter-format)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
223 (start-kbd-macro nil)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
224 (if kmacro-append-to (message "Appending to keyboard macro..."))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
225 ))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
226
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
227 (defun kmacro-call-macro (arg)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
228 "End kbd macro if currently being defined; else call last kbd macro.
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
229 With numeric prefix ARG, repeat macro that many times.
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
230 With \\[universal-argument], swap current macro with head of macro ring."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
231 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
232 (cond
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
233 (defining-kbd-macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
234 (end-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
235 (if kmacro-append-to
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
236 (setq last-kbd-macro (concat kmacro-append-to last-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
237 kmacro-append-to nil)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
238 ((and current-prefix-arg (listp current-prefix-arg))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
239 (when kmacro-ring
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
240 (let ((head (car kmacro-ring)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
241 (setq kmacro-ring (cons last-kbd-macro (cdr kmacro-ring)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
242 (setq last-kbd-macro head)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
243 (kmacro-display last-kbd-macro))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
244 (t
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
245 (setq kmacro-counter-format kmacro-counter-format-start)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
246 (call-last-kbd-macro arg))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
247
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
248 (defun kmacro-call-macro-ring (arg)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
249 "End kbd macro if currently being defined; else call last kbd macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
250 With \\[universal-argument], display current macro."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
251 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
252 (if kmacro-ring
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
253 (execute-kbd-macro (car kmacro-ring) arg)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
254
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
255 (defun kmacro-end-call-mouse (event)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
256 "Move point to the position clicked with the mouse and call last kbd macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
257 If kbd macro currently being defined end it before activating it."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
258 (interactive "e")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
259 (when defining-kbd-macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
260 (end-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
261 (if kmacro-append-to
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
262 (setq last-kbd-macro (concat kmacro-append-to last-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
263 kmacro-append-to nil)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
264 (mouse-set-point event)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
265 (call-last-kbd-macro nil))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
266
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
267 (defun kmacro-cycle-macro-ring (&optional previous)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
268 "Cycle the keyboard macro ring on \\[kmacro-call-macro-ring].
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
269 Moves to the next element in the keyboard macro ring.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
270 With \\[universal-argument] prefix, move to the previous element in the ring.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
271 Displays the selected macro in the echo area."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
272 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
273 (if (null kmacro-ring)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
274 (message "No keymacros in ring")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
275 (cond
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
276 ((not (eq this-command last-command))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
277 nil)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
278 ((= (length kmacro-ring) 1)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
279 nil)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
280 (previous
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
281 (let* ((len (length kmacro-ring))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
282 (tail (nthcdr (- len 2) kmacro-ring))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
283 (elt (car (cdr tail))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
284 (setcdr tail nil)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
285 (setq kmacro-ring (cons elt kmacro-ring))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
286 (t
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
287 (let ((elt (car kmacro-ring)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
288 (setq kmacro-ring (cdr kmacro-ring))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
289 (nconc kmacro-ring (list elt)))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
290 (kmacro-display (car kmacro-ring))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
291
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
292 (defun kmacro-save-macro-on-key (arg)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
293 "When not defining or executing a macro, offer to save last macro on a key."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
294 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
295 (if (or defining-kbd-macro executing-kbd-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
296 nil
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
297 (or last-kbd-macro
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
298 (error "No keyboard macro defined"))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
299 (let ((key-seq (read-key-sequence "Save last macro on key: ")))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
300 (or (equal key-seq "")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
301 (define-key global-map key-seq last-kbd-macro))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
302 )
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
303
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
304 (defun kmacro-set-counter (arg)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
305 "Set kmacro-counter to ARG or 0 if missing.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
306 While defining/executing key macro, increase or decrease counter.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
307 With \\[universal-argument], unconditionally set counter to 0."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
308 (interactive "p")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
309 (setq kmacro-counter
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
310 (cond ((and current-prefix-arg (listp current-prefix-arg)) 0)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
311 ((or defining-kbd-macro executing-kbd-macro) (+ kmacro-counter arg))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
312 (current-prefix-arg arg)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
313 (t 0))))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
314
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
315 (defun kmacro-set-format (format)
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
316 "Set macro counter FORMAT."
46083
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
317 (interactive "sMacro Counter Format (printf format): ")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
318 (setq kmacro-counter-format
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
319 (if (equal format "")
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
320 "%d"
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
321 format))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
322
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
323 ;; redefine initial macro counter if we are not executing a macro.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
324 (if (not (or defining-kbd-macro executing-kbd-macro))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
325 (setq kmacro-counter-format-start kmacro-counter-format))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
326 )
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
327
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
328 (defun kmacro-edit-macro ()
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
329 "Edit keyboard macro."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
330 (interactive)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
331 (edit-kbd-macro "\r"))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
332
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
333 ;;;###autoload
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
334 (defun kmacro-initialize (&optional start-key call-key call-mouse)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
335 "Setup key bindings for the keyboard macro package.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
336 If specified, use keys START-KEY, CALL-KEY, and CALL-MOUSE.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
337 Don't bind to any mouse event if CALL-MOUSE is t.
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
338 Otherwise, use customized keys."
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
339
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
340 (setq start-key (or start-key kmacro-start-key 'f7))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
341 (setq call-key (or call-key kmacro-call-key 'f8))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
342 (setq call-mouse (or call-mouse kmacro-call-mouse-event 'S-mouse-3))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
343
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
344 (global-set-key (vector start-key) 'kmacro-start-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
345 (global-set-key (vector (list 'shift start-key)) 'kmacro-set-format)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
346 (global-set-key (vector (list 'control start-key)) 'kmacro-set-counter)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
347 (global-set-key (vector (list 'meta start-key)) 'kmacro-edit-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
348
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
349 (global-set-key (vector call-key) 'kmacro-call-macro)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
350 (global-set-key (vector (list 'shift call-key)) 'kmacro-call-macro-ring)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
351 (global-set-key (vector (list 'control call-key)) 'kmacro-cycle-macro-ring)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
352
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
353 (unless (eq call-mouse t)
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
354 (global-set-key (vector call-mouse) 'kmacro-end-call-mouse)))
bd954daa704a New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
355
46099
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
356 (provide 'kmacro)
d441fc235798 Passed it through checkdoc. Moved `provide' to the end, where it belongs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46085
diff changeset
357 ;;; kmacro.el ends here