;ELC ;;; compiled by roland@churchy.gnu.ai.mit.edu on Mon May 29 16:44:06 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/edmacro.el ;;; emacs version 19.28.92.2. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/gd/gnu/emacs/19.0/lisp/edmacro.el' was compiled for Emacs 19")) (require (quote cl)) #@134 *Non-nil if edit-kbd-macro should leave 8-bit characters intact. Default nil means to write characters above \177 in octal notation. (defvar edmacro-eight-bits nil (#$ . -510)) (byte-code "! B   # #‡" [boundp edmacro-mode-map nil current-load-list make-sparse-keymap define-key "" edmacro-finish-edit "" edmacro-insert-key] 4) #@325 Edit a keyboard macro. At the prompt, type any key sequence which is bound to a keyboard macro. Or, type `C-x e' or RET to edit the last keyboard macro, `C-h l' to edit the last 100 keystrokes as a keyboard macro, or `M-x' to edit a macro by its command name. With a prefix argument, format the macro in a more concise way. (defalias 'edit-kbd-macro #[(keys &optional prefix finish-hook store-hook) "P!!  =,ȝF :!:  @ =V!K =d  r!\" 9} K \f!!\"!p\f!\"?\" !#!#! (!)+-!L!1L!L ' ! \f\"#&A@\"c)c )@A!\f=GB!CD!." [keys arrayp key-binding nil mac cmd store-hook call-last-kbd-macro (" " [return]) last-kbd-macro y-or-n-p "No keyboard macro defined. Create one? " keyboard-quit "" execute-extended-command read-command "Name of keyboard macro to edit: " view-lossage recent-keys error "Key sequence %s is not defined" key-description "Key sequence %s is not a keyboard macro" message "Formatting keyboard macro..." oldbuf edmacro-fix-menu-commands mmac edmacro-format-keys 1 fmt prefix fmtv get-buffer-create "*Edit Macro*" buf "Formatting keyboard macro...done" switch-to-buffer kill-all-local-variables use-local-map edmacro-mode-map buffer-read-only edmacro-mode major-mode "Edit Macro" mode-name make-local-variable edmacro-original-buffer edmacro-finish-hook finish-hook edmacro-store-hook erase-buffer ";; Keyboard Macro Editor. Press C-c C-c to finish; " "press C-x k RET to cancel.\n" ";; Original keys: " "\n" "\nCommand: " symbol-name "none" where-is-internal (keymap) "Key: " "Key: none\n" "\nMacro:\n\n" recenter (4) set-buffer-modified-p run-hooks edmacro-format-hook] 5 (#$ . 871) "kKeyboard macro to edit (C-x e, M-x, C-h l, or keys): \nP"]) #@48 Edit the most recently defined keyboard macro. (defalias 'edit-last-kbd-macro #[(&optional prefix) "\n\"" [edit-kbd-macro call-last-kbd-macro prefix] 3 (#$ . 2770) "P"]) #@77 Edit a keyboard macro which has been given a name by `name-last-kbd-macro'. (defalias 'edit-named-kbd-macro #[(&optional prefix) "\n\"" [edit-kbd-macro execute-extended-command prefix] 3 (#$ . 2949) "P"]) #@595 Read the region as a keyboard macro definition. The region is interpreted as spelled-out keystrokes, e.g., "M-x abc RET". See documentation for `edmacro-mode' for details. Leading/trailing "C-x (" and "C-x )" in the text are allowed and ignored. The resulting macro is installed as the "current" keyboard macro. In Lisp, may also be called with a single STRING argument in which case the result is returned rather than being installed as the current macro. The result will be a string if possible, otherwise an event vector. Second argument NEED-VECTOR means to return an event vector always. (defalias 'read-kbd-macro #[(start &optional end) ";\n\n\"\n{!" [start edmacro-parse-keys end last-kbd-macro] 3 (#$ . 3164) "r"]) #@301 Return the keyboard macro MACRO as a human-readable string. This string is suitable for passing to `read-kbd-macro'. Second argument VERBOSE means to put one command per line with comments. If VERBOSE is `1', put everything on one line. If VERBOSE is omitted or nil, use a compact 80-column format. (defalias 'format-kbd-macro #[(&optional macro verbose) "\f9\fK\n \"" [macro edmacro-format-keys last-kbd-macro verbose] 3 (#$ . 3906)]) (defalias 'edmacro-finish-edit #[nil "=\n!!Ɖe \nb !!s6!єѕ{Ӛo\"?P!\n\n!o\nK!o\n#!o )!!єѕ{!!Ӛ!\"! B !!$$!$!$!$K!!\"#! ))!bm!y!`)p+d{ -./0 1\n6 606Ӛ6!- /!F/q!!6!0b06!\n=x6GVs68\n\n6GU\n!\n6M\n\n\"<!<:<@!!!!>:>@!!!>A>* ?!?:?@!@!\n6\"?A?*)A+!/!5B/!1=1 .\n" [major-mode edmacro-mode error "This command is valid only in buffers created by `edit-kbd-macro'" run-hooks edmacro-finish-hook nil top no-keys keys cmd case-fold-search looking-at "[ ]*\\($\\|;;\\|REM[ \n]\\)" "Command:[ ]*\\([^ \n]*\\)[ ]*$" edmacro-store-hook "\"Command\" line not allowed in this context" 1 str "" equalp "none" intern fboundp arrayp y-or-n-p format "Command %s is already defined; %s" "proceed? " keyboard-quit "Key:\\(.*\\)$" "\"Key\" line not allowed in this context" edmacro-parse-keys key t key-binding b commandp "Key %s is already defined; %s" edmacro-format-keys "Macro:[ \n]*" 0 "Expected a `Macro:' line" buf buffer-modified-p modp edmacro-original-buffer obuf store-hook finish-hook "No command name or keys specified" buffer-name message "Compiling keyboard macro..." mac "Compiling keyboard macro...done" last-kbd-macro fmakunbound where-is-internal (keymap) G87900 global-unset-key G87901 G87902 global-set-key kill-buffer switch-to-buffer] 7 nil nil]) #@49 Insert the written name of a key in the buffer. (defalias 'edmacro-insert-key #[(key) "n\f \"ñ !ı" [edmacro-format-keys key t "\n" " "] 3 (#$ . 5995) "kKey to insert: "]) #@3091 \Keyboard Macro Editing mode. Press \[edmacro-finish-edit] to save and exit. To abort the edit, just kill this buffer with \[kill-buffer] RET. Press \[edmacro-insert-key] to insert the name of any key by typing the key. The editing buffer contains a "Command:" line and any number of "Key:" lines at the top. These are followed by a "Macro:" line and the macro itself as spelled-out keystrokes: `C-x C-f foo RET'. The "Command:" line specifies the command name to which the macro is bound, or "none" for no command name. Write "last-kbd-macro" to refer to the current keyboard macro (as used by \[call-last-kbd-macro]). The "Key:" lines specify key sequences to which the macro is bound, or "none" for no key bindings. You can edit these lines to change the places where the new macro is stored. Format of keyboard macros during editing: Text is divided into "words" separated by whitespace. Except for the words described below, the characters of each word go directly as characters of the macro. The whitespace that separates words is ignored. Whitespace in the macro must be written explicitly, as in "foo SPC bar RET". * The special words RET, SPC, TAB, DEL, LFD, ESC, and NUL represent special control characters. The words must be written in uppercase. * A word in angle brackets, e.g., , , or , represents a function key. (Note that in the standard configuration, the function key and the control key RET are synonymous.) You can use angle brackets on the words RET, SPC, etc., but they are not required there. * Keys can be written by their ASCII code, using a backslash followed by up to six octal digits. This is the only way to represent keys with codes above \377. * One or more prefixes M- (meta), C- (control), S- (shift), A- (alt), H- (hyper), and s- (super) may precede a character or key notation. For function keys, the prefixes may go inside or outside of the brackets: C- = . The prefixes may be written in any order: M-C-x = C-M-x. Prefixes are not allowed on multi-key words, e.g., C-abc, except that the Meta prefix is allowed on a sequence of digits and optional minus sign: M--123 = M-- M-1 M-2 M-3. * The `^' notation for control characters also works: ^M = C-m. * Double angle brackets enclose command names: <> is shorthand for M-x next-line RET. * Finally, REM or ;; causes the rest of the line to be ignored as a comment. Any word may be prefixed by a multiplier in the form of a decimal number and `*': 3* = , and 10*foo = foofoofoofoofoofoofoofoofoofoo. Multiple text keys can normally be strung together to form a word, but you may need to add whitespace if the word would look like one of the above notations: `; ; ;' is a keyboard macro with three semicolons, but `;;;' is a comment. Likewise, `\ 1 2 3' is four keys but `\123' is a single key written in octal, and `< right >' is seven keys but `' is a single function key. When in doubt, use whitespace. (defalias 'edmacro-mode #[nil "!" [error "This mode can be enabled only by `edit-kbd-macro'"] 2 (#$ . 6185) nil]) (put (quote edmacro-mode) (quote mode-class) (quote special)) (defalias 'edmacro-format-keys #[(macro &optional verbose) " !  C C#\n '̂( \"=I ; GW~HYtH\\I\\W*H=gHH\n>#!>H\nA>TH>?#Q\")H=<!=<H=TH>?8*+*S*Y-+P++*\")H=!=H=_TH>qT_H>?#Q\")034563:3@44\"556B63A36,#88#9:;<=45?@=: =@449\"5? 5@?? =A=@-A\"::;;#<A<\":B45CDB:B@44:\"55;8<95DωCBAB]C:ςD-E9HF8GGHGW+HH+HIV+HW+HJU+KH!!L=+GMZV!H\\H=!HM\\H=+\\+NOE;<EEL=0NVFFIVFXFJUNPVPNN#OQRO\"MNO؁MOOQSO\"QTO\"OUKO#OVWEN#EN8TEX=CN8VCNHY>C8N#OZ[O!!CZ[O!!0OEV\\O\"ONT8TU]:P9#O0`0OPOQO\"8^_`a8b^c8^\\&_T_^8\\^q_VVd_O#O8__8*8\"֚ePOPEE;E9fgOGhZ]i\"jE;EkE!RbOGM\\\\lVAAmPS֚SPTOPOG\\.\n.\n" [edmacro-fix-menu-commands macro append current-minor-mode-maps current-local-map current-global-map maps (end-macro 48 49 50 51 52 53 54 55 56 57 45 21 -134217683 -134217680 -134217679 -134217678 -134217677 -134217676 -134217675 -134217674 -134217673 -134217672 -134217671) pkeys 13 mdigs edmacro-eight-bits 255 127 maxkey nil case-fold-search ("NUL" "TAB" "LFD" "RET" "ESC" "SPC" "DEL" "REM") res-words vconcat [end-macro] rest-mac "" res 0 len verbose 1 one-line i G87903 128 134217600 end-macro key-binding subseq (digit-argument negative-argument) "M-" " " 21 [21] universal-argument G87905 G87906 "C-u " [21] 45 (48 49 50 51 52 53 54 55 56 57) prefix apply max G87909 map b G87910 lookup-key bind-len key fkey tlen tkey G87911 t G87912 G87913 function-key-map G87914 G87915 G87916 bind first G87917 ch 32 92 char-to-string self-insert-command 2 text desc 30 string-match "^[ACHMsS]-." "^;;\\|^<.*>$\\|^\\\\[0-9]+$\\|^[0-9]+\\*." "^\\^.$" mapconcat format "%s * %d" execute-extended-command (return 13) commandp intern-soft "<<%s>>" #[(ch) "  \fT\nGWK\n\fH:K@  \"UC \"P A .\"S\"X=jՂ=uׂ=ق=ۂ=݂=ނXႯ\\\"U%X!\")P9\"\"" [ch "ACHMsS" G87929 -1 G87930 nil pf (4194304 67108864 16777216 -134217728 8388608 33554432) G87931 bit "" G87932 logand 0 format "%c-" lsh 1 18 ch2 32 "NUL" 9 "TAB" 10 "LFD" 13 "RET" 27 "ESC" "SPC" "C-%c" 26 96 64 127 "DEL" maxkey char-to-string "\\%o" "<%s>" error "Unrecognized item in macro: %s"] 7] pos times mismatch :end1 :start2 :end2 "%d*%s" "\n" make-string 3 8 9 ";; " symbol-name 72 "\n "] 11]) (defalias 'edmacro-fix-menu-commands #[(macro) " !I GWH H:A\fA@A@ƚ< #\f@\" T\"# TA\" T * " [vectorp macro 0 nil ev i (menu-bar) vconcat subseq vector menu-bar error "Macros with mouse clicks are not %s" "supported by this command"] 7]) (defalias 'edmacro-parse-keys #[(string &optional need-vector) "\fGW1\f#1O\n \f\f\"D\fɕO!\n\fɕTO\f\f\"m!=YԂa!@a\fO# \f\"\fɔɕO\f۔ەOP\f\f\"\f!C \fޚ\f\"\f#\f!\"#\f\"!\fHA\\!\"\\\"\fO\f\f\"!\\!\"T\"\fO\f\f\"* *A\f)\f\"W\f,./02.T.,GWP,.H/2?H0_/\\\\02\"0!\f-!Ue\f !U\f;\f\"\f89:;9T98GW89H:!\\;B;;, \fGU#\"O\f#!\"U\f;\f\"!\f@A\fHB\"C\\\\C !\fH\\C + -\nDDSDY,  \")+ GEYp HF=p HG=p GZHF=p GZHH=pI #J KL/MLTLKGWKLH//N\"OYOAX)MM, PQ/RQTQPGWPQH//\"U//S\\RBRR, +" [nil 0 [] res pos case-fold-search string string-match "[^ \n\f]+" 1 times key word "\\([0-9]+\\)\\*." string-to-int "^<<.+>>$" vconcat key-binding [-134217608] execute-extended-command [-134217608] where-is-internal [-134217608] 2 -2 " " "^\\(\\([ACHMsS]-\\)*\\)<\\(.+\\)>$" 3 "\\<\\(NUL\\|RET\\|LFD\\|ESC\\|SPC\\|DEL\\)$" intern "REM" "^;;" "$" bits prefix orig-word "^[ACHMsS]-." ((65 . 4194304) (67 . 67108864) (72 . 16777216) (77 . -134217728) (115 . 8388608) (83 . 33554432)) "^\\^.$" 67108864 assoc (("NUL" . "") ("RET" . " ") ("LFD" . "\n") ("TAB" . " ") ("ESC" . "") ("SPC" . " ") ("DEL" . "")) found "^\\\\[0-7]+$" G87936 -1 G87937 ch n t G87938 8 -48 vector -134217728 "^-?[0-9]+$" G87939 G87940 x G87941 error "%s must prefix a single character, not %s" logand "[@-_.a-z?]" "?" 127 31 -67108864 G87942 4 24 40 41 subseq need-vector G87943 G87944 G87945 134217727 ch2 G87946 G87947 G87948 128] 6]) #@584 Insert in buffer the definition of kbd macro NAME, as Lisp code. Optional second arg KEYS means also record the keys it is on (this is the prefix argument, when calling interactively). This Lisp code will, when executed, define the kbd macro with the same definition it has now. If you say to record the keys, the Lisp code will also rebind those keys to the macro. Only global key bindings are recorded since executing this Lisp code always makes global bindings. To save a kbd macro, visit a file of Lisp code such as your `~/.emacs', use this command, and then save the file. (defalias 'insert-kbd-macro #[(macroname &optional keys) " !Ę c ! \"c GV*c-c p\"cX \"W@ #cAD))" [nil definition symbol-name macroname "" format-kbd-macro "(setq last-kbd-macro" format "(defalias '%s" 50 " (read-kbd-macro\n" "\n (read-kbd-macro " prin1 "))\n" keys where-is-internal (keymap) "(global-set-key %S '%s)\n"] 5 (#$ . 14751) "CInsert kbd macro (name): \nP"]) (provide (quote edmacro))