Mercurial > emacs
comparison lisp/edmacro.el @ 16283:e71331297a43
(insert-kbd-macro): Duplicate definition deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 22 Sep 1996 21:38:19 +0000 |
parents | fea038c6da68 |
children | 156fd377c7d0 |
comparison
equal
deleted
inserted
replaced
16282:40f7e9a1829c | 16283:e71331297a43 |
---|---|
714 (and (>= ch2 0) (<= ch2 127)))))) | 714 (and (>= ch2 0) (<= ch2 127)))))) |
715 (concat (loop for ch across res | 715 (concat (loop for ch across res |
716 collect (if (= (logand ch ?\M-\^@) 0) | 716 collect (if (= (logand ch ?\M-\^@) 0) |
717 ch (+ ch 128)))) | 717 ch (+ ch 128)))) |
718 res))) | 718 res))) |
719 | |
720 ;;; The following probably ought to go in macros.el: | |
721 | |
722 ;;;###autoload | |
723 (defun insert-kbd-macro (macroname &optional keys) | |
724 "Insert in buffer the definition of kbd macro NAME, as Lisp code. | |
725 Optional second arg KEYS means also record the keys it is on | |
726 \(this is the prefix argument, when calling interactively). | |
727 | |
728 This Lisp code will, when executed, define the kbd macro with the same | |
729 definition it has now. If you say to record the keys, the Lisp code | |
730 will also rebind those keys to the macro. Only global key bindings | |
731 are recorded since executing this Lisp code always makes global | |
732 bindings. | |
733 | |
734 To save a kbd macro, visit a file of Lisp code such as your `~/.emacs', | |
735 use this command, and then save the file." | |
736 (interactive "CInsert kbd macro (name): \nP") | |
737 (let (definition) | |
738 (if (string= (symbol-name macroname) "") | |
739 (progn | |
740 (setq definition (format-kbd-macro)) | |
741 (insert "(setq last-kbd-macro")) | |
742 (setq definition (format-kbd-macro macroname)) | |
743 (insert (format "(defalias '%s" macroname))) | |
744 (if (> (length definition) 50) | |
745 (insert " (read-kbd-macro\n") | |
746 (insert "\n (read-kbd-macro ")) | |
747 (prin1 definition (current-buffer)) | |
748 (insert "))\n") | |
749 (if keys | |
750 (let ((keys (where-is-internal macroname '(keymap)))) | |
751 (while keys | |
752 (insert (format "(global-set-key %S '%s)\n" (car keys) macroname)) | |
753 (setq keys (cdr keys))))))) | |
754 | 719 |
755 (provide 'edmacro) | 720 (provide 'edmacro) |
756 | 721 |
757 ;;; edmacro.el ends here | 722 ;;; edmacro.el ends here |
758 | 723 |