annotate lisp/prim/macros.el @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents 8eaf7971accc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; macros.el --- non-primitive commands for keyboard macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 92, 94, 95 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: abbrev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 22
diff changeset
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
25 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; Extension commands for keyboard macros. These permit you to assign
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; a name to the last-defined keyboard macro, expand and insert the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; lisp corresponding to a macro, query the user from within a macro,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; or apply a macro to each line in the reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
34 ;; This file is largely superseded by edmacro.el as of XEmacs 20.1. -sb
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
35
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun name-last-kbd-macro (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Assign a name to the last keyboard macro defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Argument SYMBOL is the name to define.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 The symbol's function definition becomes the keyboard macro string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Such a \"function\" cannot be called from Lisp, but it is a valid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 editor command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (interactive "SName for last kbd macro: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (or last-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (error "No keyboard macro defined"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (and (fboundp symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (not (stringp (symbol-function symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (not (vectorp (symbol-function symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (error "Function %s is already defined and not a keyboard macro."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 symbol))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
53 (if (string-equal symbol "")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
54 (error "No command name given"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (fset symbol last-kbd-macro))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
57 ;;; Moved here from edmacro.el:
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
58
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
59 ;;;###autoload
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
60 (defun insert-kbd-macro (macroname &optional keys)
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
61 "Insert in buffer the definition of kbd macro NAME, as Lisp code.
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
62 Optional second arg KEYS means also record the keys it is on
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
63 \(this is the prefix argument, when calling interactively).
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
64
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
65 This Lisp code will, when executed, define the kbd macro with the same
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
66 definition it has now. If you say to record the keys, the Lisp code
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
67 will also rebind those keys to the macro. Only global key bindings
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
68 are recorded since executing this Lisp code always makes global
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
69 bindings.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
71 To save a kbd macro, visit a file of Lisp code such as your `~/.emacs',
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
72 use this command, and then save the file."
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
73 (interactive "CInsert kbd macro (name): \nP")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
74 (let (definition)
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
75 (if (string= (symbol-name macroname) "")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
76 (progn
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
77 (setq definition (format-kbd-macro))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
78 (insert "(setq last-kbd-macro"))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
79 (setq definition (format-kbd-macro macroname))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
80 (insert (format "(defalias '%s" macroname)))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
81 (if (> (length definition) 50)
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
82 (insert " (read-kbd-macro\n")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
83 (insert "\n (read-kbd-macro "))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
84 (prin1 definition (current-buffer))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
85 (insert "))\n")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
86 (if keys
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
87 (let ((keys (where-is-internal macroname)))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
88 (while keys
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
89 (insert (format "(global-set-key %S '%s)\n" (car keys) macroname))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
90 (pop keys))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun kbd-macro-query (flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 "Query user during kbd macro execution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 With prefix argument, enters recursive edit,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 reading keyboard commands even within a kbd macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 You can give different commands each time the macro executes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 Without prefix argument, asks whether to continue running the macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Your options are: \\<query-replace-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 \\[act] Finish this iteration normally and continue with the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 \\[skip] Skip the rest of this iteration, and start the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 \\[exit] Stop the macro entirely right now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 \\[recenter] Redisplay the frame, then ask again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 \\[edit] Enter recursive edit; ask again when you exit from that."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (interactive "P")
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
106 (or executing-kbd-macro
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 defining-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (error "Not defining or executing kbd macro"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (if flag
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
110 (let (executing-kbd-macro defining-kbd-macro)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (recursive-edit))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
112 (if (not executing-kbd-macro)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (let ((loop t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (msg (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "Proceed with macro?\\<query-replace-map>\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (\\[act], \\[skip], \\[exit], \\[recenter], \\[edit]) ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (while loop
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
119 (let ((key (let ((executing-kbd-macro nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (defining-kbd-macro nil))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
121 (message "%s" msg)
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
122 ;; XEmacs: avoid `read-char'.
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
123 (read-char-exclusive)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 def)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (setq key (vector key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (setq def (lookup-key query-replace-map key))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (cond ((eq def 'act)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (setq loop nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ((eq def 'skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (setq loop nil)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
131 (setq executing-kbd-macro ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ((eq def 'exit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (setq loop nil)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
134 (setq executing-kbd-macro t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ((eq def 'recenter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (recenter nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ((eq def 'edit)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 98
diff changeset
138 (let (executing-kbd-macro defining-kbd-macro)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (recursive-edit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ((eq def 'quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (setq quit-flag t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (or (eq def 'help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (ding))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (with-output-to-temp-buffer "*Help*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (princ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "Specify how to proceed with keyboard macro execution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 Possibilities: \\<query-replace-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 \\[act] Finish this iteration normally and continue with the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 \\[skip] Skip the rest of this iteration, and start the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 \\[exit] Stop the macro entirely right now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 \\[recenter] Redisplay the frame, then ask again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 \\[edit] Enter recursive edit; ask again when you exit from that."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (help-mode)))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defun apply-macro-to-region-lines (top bottom &optional macro)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "For each complete line between point and mark, move to the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 of the line, and run the last keyboard macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 When called from lisp, this function takes two arguments TOP and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 BOTTOM, describing the current region. TOP must be before BOTTOM.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 The optional third argument MACRO specifies a keyboard macro to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 execute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 This is useful for quoting or unquoting included text, adding and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 removing comments, or producing tables where the entries are regular.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 For example, in Usenet articles, sections of text quoted from another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 author are indented, or have each line start with `>'. To quote a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 section of text, define a keyboard macro which inserts `>', put point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 and mark at opposite ends of the quoted section, and use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 `\\[apply-macro-to-region-lines]' to mark the entire section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 Suppose you wanted to build a keyword table in C where each entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 looked like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 { \"foo\", foo_data, foo_function },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 { \"bar\", bar_data, bar_function },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 { \"baz\", baz_data, baz_function },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 You could enter the names in this format:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 baz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 and write a macro to massage a word into a table entry:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 \\C-x (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 \\M-d { \"\\C-y\", \\C-y_data, \\C-y_function },
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 \\C-x )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 and then select the region of un-tablified names and use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 `\\[apply-macro-to-region-lines]' to build the table from the names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (or macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (if (null last-kbd-macro)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (error "No keyboard macro has been defined."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (setq macro last-kbd-macro)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (let ((end-marker (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (goto-char bottom)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (point-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 next-line-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (goto-char top)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (if (not (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (setq next-line-marker (point-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (while (< next-line-marker end-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (goto-char next-line-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (set-marker next-line-marker (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (execute-kbd-macro (or macro last-kbd-macro))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (set-marker end-marker nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (set-marker next-line-marker nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;;; macros.el ends here