summaryrefslogtreecommitdiff
path: root/lisp/edmacro.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-06-21 09:53:01 +0000
committerRichard M. Stallman <rms@gnu.org>2002-06-21 09:53:01 +0000
commit5cfe1cece18547a3a7548450a5f06287f531dfbd (patch)
tree942d3fa90ccc61a5ebf7bed32a7c71aad7dc5cee /lisp/edmacro.el
parentbbe4fd22c2fcb94c5845bc446714086187b3ddbd (diff)
downloademacs-5cfe1cece18547a3a7548450a5f06287f531dfbd.tar.gz
(edmacro-fix-menu-commands):
Discard `help-echo' events. Handle (menu-bar) events. Simplify by converting key sequence to a list and then back to vector.
Diffstat (limited to 'lisp/edmacro.el')
-rw-r--r--lisp/edmacro.el31
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 8a3201567c1..e01e5960ff5 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -609,23 +609,30 @@ If START or END is negative, it counts from the end."
(setq i (1+ i) start (1+ start)))
res))))))
-(defun edmacro-fix-menu-commands (macro)
- (when (vectorp macro)
- (let ((i 0) ev)
- (while (< i (length macro))
- (when (consp (setq ev (aref macro i)))
- (cond ((equal (cadadr ev) '(menu-bar))
- (setq macro (vconcat (edmacro-subseq macro 0 i)
- (vector 'menu-bar (car ev))
- (edmacro-subseq macro (1+ i))))
- (incf i))
+(defun edmacro-fix-menu-commands (macro &optional noerror)
+ (if (vectorp macro)
+ (let (result)
+ ;; Make a list of the elements.
+ (setq macro (append macro nil))
+ (dolist (ev macro)
+ (cond ((atom ev)
+ (push ev result))
+ ((eq (car ev) 'help-echo))
+ ((equal ev '(menu-bar))
+ (push 'menu-bar result))
+ ((equal (cadadr ev) '(menu-bar))
+ (push (vector 'menu-bar (car ev)) result))
;; It would be nice to do pop-up menus, too, but not enough
;; info is recorded in macros to make this possible.
+ (noerror
+ ;; Just ignore mouse events.
+ nil)
(t
(error "Macros with mouse clicks are not %s"
"supported by this command"))))
- (incf i))))
- macro)
+ ;; Reverse them again and make them back into a vector.
+ (vconcat (nreverse result)))
+ macro))
;;; Parsing a human-readable keyboard macro.