Mercurial > emacs
comparison lisp/macros.el @ 217:8977ce293397
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 15 Mar 1991 20:39:25 +0000 |
parents | 2c663336acaf |
children | 7e4c7ef44243 |
comparison
equal
deleted
inserted
replaced
216:2c663336acaf | 217:8977ce293397 |
---|---|
20 | 20 |
21 (defun name-last-kbd-macro (symbol) | 21 (defun name-last-kbd-macro (symbol) |
22 "Assign a name to the last keyboard macro defined. | 22 "Assign a name to the last keyboard macro defined. |
23 Argument SYMBOL is the name to define. | 23 Argument SYMBOL is the name to define. |
24 The symbol's function definition becomes the keyboard macro string. | 24 The symbol's function definition becomes the keyboard macro string. |
25 Such a \"function\" cannot be called from Lisp, but it is a valid command | 25 Such a \"function\" cannot be called from Lisp, but it is a valid editor command." |
26 definition for the editor command loop." | |
27 (interactive "SName for last kbd macro: ") | 26 (interactive "SName for last kbd macro: ") |
28 (or last-kbd-macro | 27 (or last-kbd-macro |
29 (error "No keyboard macro defined")) | 28 (error "No keyboard macro defined")) |
30 (and (fboundp symbol) | 29 (and (fboundp symbol) |
31 (not (stringp (symbol-function symbol))) | 30 (not (stringp (symbol-function symbol))) |
33 symbol)) | 32 symbol)) |
34 (fset symbol last-kbd-macro)) | 33 (fset symbol last-kbd-macro)) |
35 | 34 |
36 (defun insert-kbd-macro (macroname &optional keys) | 35 (defun insert-kbd-macro (macroname &optional keys) |
37 "Insert in buffer the definition of kbd macro NAME, as Lisp code. | 36 "Insert in buffer the definition of kbd macro NAME, as Lisp code. |
38 Second argument KEYS non-nil means also record the keys it is on. | 37 Optional second arg KEYS means also record the keys it is on |
39 (This is the prefix argument, when calling interactively.) | 38 (this is the prefix argument, when calling interactively). |
40 | 39 |
41 This Lisp code will, when executed, define the kbd macro with the | 40 This Lisp code will, when executed, define the kbd macro with the same |
42 same definition it has now. If you say to record the keys, | 41 definition it has now. If you say to record the keys, the Lisp code |
43 the Lisp code will also rebind those keys to the macro. | 42 will also rebind those keys to the macro. Only global key bindings |
44 Only global key bindings are recorded since executing this Lisp code | 43 are recorded since executing this Lisp code always makes global |
45 always makes global bindings. | 44 bindings. |
46 | 45 |
47 To save a kbd macro, visit a file of Lisp code such as your ~/.emacs, | 46 To save a kbd macro, visit a file of Lisp code such as your ~/.emacs, |
48 use this command, and then save the file." | 47 use this command, and then save the file." |
49 (interactive "CInsert kbd macro (name): \nP") | 48 (interactive "CInsert kbd macro (name): \nP") |
50 (insert "(fset '") | 49 (insert "(fset '") |
62 (insert ")\n") | 61 (insert ")\n") |
63 (setq keys (cdr keys)))))) | 62 (setq keys (cdr keys)))))) |
64 | 63 |
65 (defun kbd-macro-query (flag) | 64 (defun kbd-macro-query (flag) |
66 "Query user during kbd macro execution. | 65 "Query user during kbd macro execution. |
67 With prefix argument, enters recursive edit, | 66 With prefix argument, enters recursive edit, reading keyboard |
68 reading keyboard commands even within a kbd macro. | 67 commands even within a kbd macro. You can give different commands |
69 You can give different commands each time the macro executes. | 68 each time the macro executes. |
70 Without prefix argument, reads a character. Your options are: | 69 Without prefix argument, reads a character. Your options are: |
71 Space -- execute the rest of the macro. | 70 Space -- execute the rest of the macro. |
72 DEL -- skip the rest of the macro; start next repetition. | 71 DEL -- skip the rest of the macro; start next repetition. |
73 C-d -- skip rest of the macro and don't repeat it any more. | 72 C-d -- skip rest of the macro and don't repeat it any more. |
74 C-r -- enter a recursive edit, then on exit ask again for a character | 73 C-r -- enter a recursive edit, then on exit ask again for a character |
75 C-l -- redisplay screen and ask again." | 74 C-l -- redisplay screen and ask again." |
76 (interactive "P") | 75 (interactive "P") |
77 (or executing-macro | 76 (or executing-macro |
78 defining-kbd-macro | 77 defining-kbd-macro |
79 (error "Not defining or executing kbd macro")) | 78 (error "Not defining or executing kbd macro")) |
80 (if flag | 79 (if flag |