Mercurial > emacs
comparison lisp/edmacro.el @ 45939:6ccb89338ab1
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 21 Jun 2002 09:53:01 +0000 |
parents | b174db545cfd |
children | f3d2ffc730b3 |
comparison
equal
deleted
inserted
replaced
45938:0616b57a6e43 | 45939:6ccb89338ab1 |
---|---|
607 (while (< start end) | 607 (while (< start end) |
608 (aset res i (aref seq start)) | 608 (aset res i (aref seq start)) |
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 |
632 (defun edmacro-parse-keys (string &optional need-vector) | 639 (defun edmacro-parse-keys (string &optional need-vector) |
633 (let ((case-fold-search nil) | 640 (let ((case-fold-search nil) |