comparison lisp/edmacro.el @ 199:b3710ab30435

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Thu, 28 Feb 1991 19:32:54 +0000
parents d649664df7e0
children 1e0bc00dca7a
comparison
equal deleted inserted replaced
198:db1d84cdb2e2 199:b3710ab30435
33 (edmacro-edit-macro last-kbd-macro 33 (edmacro-edit-macro last-kbd-macro
34 (function (lambda (x arg) (setq last-kbd-macro x))) 34 (function (lambda (x arg) (setq last-kbd-macro x)))
35 prefix buffer hook)) 35 prefix buffer hook))
36 36
37 (defun edit-kbd-macro (cmd &optional prefix buffer hook in-hook out-hook) 37 (defun edit-kbd-macro (cmd &optional prefix buffer hook in-hook out-hook)
38 "Edit a keyboard macro which has been assigned a name by name-last-kbd-macro. 38 "Edit a keyboard macro which has been given a name by `name-last-kbd-macro'.
39 \(See also edit-last-kbd-macro.)" 39 \(See also `edit-last-kbd-macro'.)"
40 (interactive "CCommand name: \nP") 40 (interactive "CCommand name: \nP")
41 (and cmd 41 (and cmd
42 (edmacro-edit-macro (if in-hook 42 (edmacro-edit-macro (if in-hook
43 (funcall in-hook cmd) 43 (funcall in-hook cmd)
44 (symbol-function cmd)) 44 (symbol-function cmd))
49 'x))) 49 'x)))
50 prefix buffer hook cmd))) 50 prefix buffer hook cmd)))
51 51
52 (defun read-kbd-macro (start end) 52 (defun read-kbd-macro (start end)
53 "Read the region as a keyboard macro definition. 53 "Read the region as a keyboard macro definition.
54 The region is interpreted as spelled-out keystrokes, e.g., `M-x abc RET'. 54 The region is interpreted as spelled-out keystrokes, e.g., \"M-x abc RET\".
55 The resulting macro is installed as the \"current\" keyboard macro. 55 The resulting macro is installed as the \"current\" keyboard macro.
56 56
57 Symbols: RET, SPC, TAB, DEL, LFD, NUL; C-key; M-key. (Must be uppercase.) 57 Symbols: RET, SPC, TAB, DEL, LFD, NUL; C-key; M-key. (Must be uppercase.)
58 REM marks the rest of a line as a comment. 58 REM marks the rest of a line as a comment.
59 Whitespace is ignored; other characters are copied into the macro." 59 Whitespace is ignored; other characters are copied into the macro."
595 (or (and (boundp 'edmacro-original-buffer) 595 (or (and (boundp 'edmacro-original-buffer)
596 (boundp 'edmacro-replace-function) 596 (boundp 'edmacro-replace-function)
597 (boundp 'edmacro-replace-argument) 597 (boundp 'edmacro-replace-argument)
598 (boundp 'edmacro-finish-hook) 598 (boundp 'edmacro-finish-hook)
599 (eq major-mode 'edmacro-mode)) 599 (eq major-mode 'edmacro-mode))
600 (error "This command is valid only in buffers created by edit-kbd-macro.")) 600 (error "This command is valid only in buffers created by `edit-kbd-macro'."))
601 (let ((buf (current-buffer)) 601 (let ((buf (current-buffer))
602 (str (buffer-string)) 602 (str (buffer-string))
603 (func edmacro-replace-function) 603 (func edmacro-replace-function)
604 (arg edmacro-replace-argument) 604 (arg edmacro-replace-argument)
605 (hook edmacro-finish-hook)) 605 (hook edmacro-finish-hook))
621 (kill-buffer buf) 621 (kill-buffer buf)
622 (if hook 622 (if hook
623 (funcall hook arg)))) 623 (funcall hook arg))))
624 624
625 (defun edmacro-mode () 625 (defun edmacro-mode ()
626 "Keyboard Macro Editing mode. Press C-c C-c to save and exit. 626 "\\<edmacro-mode-map>Keyboard Macro Editing mode. Press \\[edmacro-finish-edit] to save and exit.
627 To abort the edit, just kill this buffer with C-x k RET. 627 To abort the edit, just kill this buffer with \\[kill-buffer] RET.
628 628
629 The keyboard macro is represented as a series of M-x style command names. 629 The keyboard macro is represented as a series of M-x style command names.
630 Keystrokes which do not correspond to simple M-x commands are written as 630 Keystrokes which do not correspond to simple M-x commands are written as
631 \"type\" commands. When you press C-c C-c, edmacro converts each command 631 \"type\" commands. When you press \\[edmacro-finish-edit], edmacro converts each command
632 back into a suitable keystroke sequence; \"type\" commands are converted 632 back into a suitable keystroke sequence; \"type\" commands are converted
633 directly back into keystrokes." 633 directly back into keystrokes."
634 (interactive) 634 (interactive)
635 (error "This mode can be enabled only by edit-kbd-macro or edit-last-kbd-macro.")) 635 (error "This mode can be enabled only by `edit-kbd-macro' or `edit-last-kbd-macro'."))
636 (put 'edmacro-mode 'mode-class 'special) 636 (put 'edmacro-mode 'mode-class 'special)
637 637
638 (if (boundp 'edmacro-mode-map) () 638 (if (boundp 'edmacro-mode-map) ()
639 (setq edmacro-mode-map (make-sparse-keymap)) 639 (setq edmacro-mode-map (make-sparse-keymap))
640 (define-key edmacro-mode-map "\C-c\C-c" 'edmacro-finish-edit)) 640 (define-key edmacro-mode-map "\C-c\C-c" 'edmacro-finish-edit))