Mercurial > hg > xemacs-beta
comparison lisp/utils/edmacro.el @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | 0132846995bd |
children | b405438285a2 |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Dave Gillespie <daveg@synaptics.com> | 5 ;; Author: Dave Gillespie <daveg@synaptics.com> |
6 ;; Hrvoje Niksic <hniksic@srce.hr> -- XEmacs port | 6 ;; Hrvoje Niksic <hniksic@srce.hr> -- XEmacs port |
7 ;; Maintainer: Hrvoje Niksic <hniksic@srce.hr> | 7 ;; Maintainer: Hrvoje Niksic <hniksic@srce.hr> |
8 ;; Version: 3.16 | 8 ;; Version: 3.17 |
9 ;; Keywords: abbrev | 9 ;; Keywords: abbrev |
10 | 10 |
11 ;; This file is part of XEmacs. | 11 ;; This file is part of XEmacs. |
12 | 12 |
13 ;; XEmacs is free software; you can redistribute it and/or modify | 13 ;; XEmacs is free software; you can redistribute it and/or modify |
755 nil) | 755 nil) |
756 1 self-insert-p) | 756 1 self-insert-p) |
757 (and macro (if verbose "\n" " "))))))) | 757 (and macro (if verbose "\n" " "))))))) |
758 res)) | 758 res)) |
759 | 759 |
760 | |
761 ;;; The following probably ought to go in macros.el: | |
762 | |
763 ;;;###autoload | |
764 (defun insert-kbd-macro (macroname &optional keys) | |
765 "Insert in buffer the definition of kbd macro NAME, as Lisp code. | |
766 Optional second arg KEYS means also record the keys it is on | |
767 \(this is the prefix argument, when calling interactively). | |
768 | |
769 This Lisp code will, when executed, define the kbd macro with the same | |
770 definition it has now. If you say to record the keys, the Lisp code | |
771 will also rebind those keys to the macro. Only global key bindings | |
772 are recorded since executing this Lisp code always makes global | |
773 bindings. | |
774 | |
775 To save a kbd macro, visit a file of Lisp code such as your `~/.emacs', | |
776 use this command, and then save the file." | |
777 (interactive "CInsert kbd macro (name): \nP") | |
778 (let (definition) | |
779 (if (string= (symbol-name macroname) "") | |
780 (progn | |
781 (setq definition (format-kbd-macro)) | |
782 (insert "(setq last-kbd-macro")) | |
783 (setq definition (format-kbd-macro macroname)) | |
784 (insert (format "(defalias '%s" macroname))) | |
785 (if (> (length definition) 50) | |
786 (insert " (read-kbd-macro\n") | |
787 (insert "\n (read-kbd-macro ")) | |
788 (prin1 definition (current-buffer)) | |
789 (insert "))\n") | |
790 (if keys | |
791 (let ((keys (where-is-internal macroname))) | |
792 (while keys | |
793 (insert (format "(global-set-key %S '%s)\n" (car keys) macroname)) | |
794 (pop keys)))))) | |
795 | |
796 (provide 'edmacro) | 760 (provide 'edmacro) |
797 | 761 |
798 ;;; edmacro.el ends here | 762 ;;; edmacro.el ends here |