diff options
| -rw-r--r-- | lisp/tmm.el | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/lisp/tmm.el b/lisp/tmm.el index c2ffd5e62bf..617af0079d3 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | (defvar tmm-short-cuts) | 41 | (defvar tmm-short-cuts) |
| 42 | (defvar tmm-old-mb-map nil) | 42 | (defvar tmm-old-mb-map nil) |
| 43 | (defvar tmm-old-comp-map) | 43 | (defvar tmm-old-comp-map) |
| 44 | (defvar tmm-c-prompt) | 44 | (defvar tmm-c-prompt nil) |
| 45 | (defvar tmm-km-list) | 45 | (defvar tmm-km-list) |
| 46 | (defvar tmm-next-shortcut-digit) | 46 | (defvar tmm-next-shortcut-digit) |
| 47 | (defvar tmm-table-undef) | 47 | (defvar tmm-table-undef) |
| @@ -71,17 +71,18 @@ we make that menu bar item (the one at that position) the default choice." | |||
| 71 | (list this-one))))) | 71 | (list this-one))))) |
| 72 | (setq list (cdr list)))) | 72 | (setq list (cdr list)))) |
| 73 | (if x-position | 73 | (if x-position |
| 74 | (let ((tail menu-bar) | 74 | (let ((tail menu-bar) (column 0) |
| 75 | this-one | 75 | this-one name) |
| 76 | (column 0)) | ||
| 77 | (while (and tail (<= column x-position)) | 76 | (while (and tail (<= column x-position)) |
| 78 | (setq this-one (car tail)) | 77 | (setq this-one (car tail)) |
| 79 | (if (and (consp this-one) | 78 | (if (and (consp this-one) |
| 80 | (consp (cdr this-one)) | 79 | (consp (cdr this-one)) |
| 81 | (stringp (nth 1 this-one))) | 80 | (setq name ; nil if menu-item |
| 82 | (setq column (+ column | 81 | (cond ((stringp (nth 1 this-one)) |
| 83 | (length (nth 1 this-one)) | 82 | (nth 1 this-one)) |
| 84 | 1))) | 83 | ((stringp (nth 2 this-one)) |
| 84 | (nth 2 this-one))))) | ||
| 85 | (setq column (+ column (length name) 1))) | ||
| 85 | (setq tail (cdr tail))) | 86 | (setq tail (cdr tail))) |
| 86 | (setq menu-bar-item (car this-one)))) | 87 | (setq menu-bar-item (car this-one)))) |
| 87 | (tmm-prompt menu-bar nil menu-bar-item))) | 88 | (tmm-prompt menu-bar nil menu-bar-item))) |
| @@ -517,7 +518,7 @@ If KEYSEQ is a prefix key that has local and global bindings, | |||
| 517 | we merge them into a single keymap which shows the proper order of the menu. | 518 | we merge them into a single keymap which shows the proper order of the menu. |
| 518 | However, for the menu bar itself, the value does not take account | 519 | However, for the menu bar itself, the value does not take account |
| 519 | of `menu-bar-final-items'." | 520 | of `menu-bar-final-items'." |
| 520 | (let (allbind bind) | 521 | (let (allbind bind minorbind localbind globalbind) |
| 521 | (setq bind (key-binding keyseq)) | 522 | (setq bind (key-binding keyseq)) |
| 522 | ;; If KEYSEQ is a prefix key, then BIND is either nil | 523 | ;; If KEYSEQ is a prefix key, then BIND is either nil |
| 523 | ;; or a symbol defined as a keymap (which satisfies keymapp). | 524 | ;; or a symbol defined as a keymap (which satisfies keymapp). |
| @@ -528,9 +529,21 @@ of `menu-bar-final-items'." | |||
| 528 | (progn | 529 | (progn |
| 529 | ;; Otherwise, it is a prefix, so make a list of the subcommands. | 530 | ;; Otherwise, it is a prefix, so make a list of the subcommands. |
| 530 | ;; Make a list of all the bindings in all the keymaps. | 531 | ;; Make a list of all the bindings in all the keymaps. |
| 531 | (setq allbind (mapcar 'cdr (minor-mode-key-binding keyseq))) | 532 | (setq minorbind (mapcar 'cdr (minor-mode-key-binding keyseq))) |
| 532 | (setq allbind (cons (local-key-binding keyseq) allbind)) | 533 | (setq localbind (local-key-binding keyseq)) |
| 533 | (setq allbind (cons (global-key-binding keyseq) allbind)) | 534 | (setq globalbind (cdr (global-key-binding keyseq))) |
| 535 | |||
| 536 | ;; If items have been redefined/undefined locally, remove them from | ||
| 537 | ;; the global list. | ||
| 538 | (dolist (minor minorbind) | ||
| 539 | (dolist (item (cdr minor)) | ||
| 540 | (setq globalbind (assq-delete-all (car item) globalbind)))) | ||
| 541 | (dolist (item (cdr localbind)) | ||
| 542 | (setq globalbind (assq-delete-all (car item) globalbind))) | ||
| 543 | |||
| 544 | (setq globalbind (cons 'keymap globalbind)) | ||
| 545 | (setq allbind (cons globalbind (cons localbind minorbind))) | ||
| 546 | |||
| 534 | ;; Merge all the elements of ALLBIND into one keymap. | 547 | ;; Merge all the elements of ALLBIND into one keymap. |
| 535 | (mapc (lambda (in) | 548 | (mapc (lambda (in) |
| 536 | (if (and (symbolp in) (keymapp in)) | 549 | (if (and (symbolp in) (keymapp in)) |