609 |
(setq i (1+ i) start (1+ start))) |
(setq i (1+ i) start (1+ start))) |
610 |
res)))))) |
res)))))) |
611 |
|
|
612 |
(defun edmacro-fix-menu-commands (macro) |
(defun edmacro-fix-menu-commands (macro &optional noerror) |
613 |
(when (vectorp macro) |
(if (vectorp macro) |
614 |
(let ((i 0) ev) |
(let (result) |
615 |
(while (< i (length macro)) |
;; Make a list of the elements. |
616 |
(when (consp (setq ev (aref macro i))) |
(setq macro (append macro nil)) |
617 |
(cond ((equal (cadadr ev) '(menu-bar)) |
(dolist (ev macro) |
618 |
(setq macro (vconcat (edmacro-subseq macro 0 i) |
(cond ((atom ev) |
619 |
(vector 'menu-bar (car ev)) |
(push ev result)) |
620 |
(edmacro-subseq macro (1+ i)))) |
((eq (car ev) 'help-echo)) |
621 |
(incf i)) |
((equal ev '(menu-bar)) |
622 |
|
(push 'menu-bar result)) |
623 |
|
((equal (cadadr ev) '(menu-bar)) |
624 |
|
(push (vector 'menu-bar (car ev)) result)) |
625 |
;; It would be nice to do pop-up menus, too, but not enough |
;; It would be nice to do pop-up menus, too, but not enough |
626 |
;; info is recorded in macros to make this possible. |
;; info is recorded in macros to make this possible. |
627 |
|
(noerror |
628 |
|
;; Just ignore mouse events. |
629 |
|
nil) |
630 |
(t |
(t |
631 |
(error "Macros with mouse clicks are not %s" |
(error "Macros with mouse clicks are not %s" |
632 |
"supported by this command")))) |
"supported by this command")))) |
633 |
(incf i)))) |
;; Reverse them again and make them back into a vector. |
634 |
macro) |
(vconcat (nreverse result))) |
635 |
|
macro)) |
636 |
|
|
637 |
;;; Parsing a human-readable keyboard macro. |
;;; Parsing a human-readable keyboard macro. |
638 |
|
|