diff options
| author | Richard M. Stallman | 2002-06-21 09:53:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-06-21 09:53:01 +0000 |
| commit | 5cfe1cece18547a3a7548450a5f06287f531dfbd (patch) | |
| tree | 942d3fa90ccc61a5ebf7bed32a7c71aad7dc5cee | |
| parent | bbe4fd22c2fcb94c5845bc446714086187b3ddbd (diff) | |
| download | emacs-5cfe1cece18547a3a7548450a5f06287f531dfbd.tar.gz emacs-5cfe1cece18547a3a7548450a5f06287f531dfbd.zip | |
(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.
| -rw-r--r-- | lisp/edmacro.el | 31 |
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." | |||
| 609 | (setq i (1+ i) start (1+ start))) | 609 | (setq i (1+ i) start (1+ start))) |
| 610 | res)))))) | 610 | res)))))) |
| 611 | 611 | ||
| 612 | (defun edmacro-fix-menu-commands (macro) | 612 | (defun edmacro-fix-menu-commands (macro &optional noerror) |
| 613 | (when (vectorp macro) | 613 | (if (vectorp macro) |
| 614 | (let ((i 0) ev) | 614 | (let (result) |
| 615 | (while (< i (length macro)) | 615 | ;; Make a list of the elements. |
| 616 | (when (consp (setq ev (aref macro i))) | 616 | (setq macro (append macro nil)) |
| 617 | (cond ((equal (cadadr ev) '(menu-bar)) | 617 | (dolist (ev macro) |
| 618 | (setq macro (vconcat (edmacro-subseq macro 0 i) | 618 | (cond ((atom ev) |
| 619 | (vector 'menu-bar (car ev)) | 619 | (push ev result)) |
| 620 | (edmacro-subseq macro (1+ i)))) | 620 | ((eq (car ev) 'help-echo)) |
| 621 | (incf i)) | 621 | ((equal ev '(menu-bar)) |
| 622 | (push 'menu-bar result)) | ||
| 623 | ((equal (cadadr ev) '(menu-bar)) | ||
| 624 | (push (vector 'menu-bar (car ev)) result)) | ||
| 622 | ;; It would be nice to do pop-up menus, too, but not enough | 625 | ;; It would be nice to do pop-up menus, too, but not enough |
| 623 | ;; info is recorded in macros to make this possible. | 626 | ;; info is recorded in macros to make this possible. |
| 627 | (noerror | ||
| 628 | ;; Just ignore mouse events. | ||
| 629 | nil) | ||
| 624 | (t | 630 | (t |
| 625 | (error "Macros with mouse clicks are not %s" | 631 | (error "Macros with mouse clicks are not %s" |
| 626 | "supported by this command")))) | 632 | "supported by this command")))) |
| 627 | (incf i)))) | 633 | ;; Reverse them again and make them back into a vector. |
| 628 | macro) | 634 | (vconcat (nreverse result))) |
| 635 | macro)) | ||
| 629 | 636 | ||
| 630 | ;;; Parsing a human-readable keyboard macro. | 637 | ;;; Parsing a human-readable keyboard macro. |
| 631 | 638 | ||