1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

* tmm.el: Add missing key-binding shortcuts.

(tmm-prompt): Remove obsolete call to x-popup-menu.
(tmm-get-keymap): Add key-binding shortcuts now that they're not
available in the "keyseq cache" any more.
This commit is contained in:
Stefan Monnier 2010-04-19 10:34:01 -04:00
parent 9166b0f33f
commit b5feea0fea
2 changed files with 22 additions and 22 deletions

View File

@ -1,5 +1,9 @@
2010-04-19 Stefan Monnier <monnier@iro.umontreal.ca> 2010-04-19 Stefan Monnier <monnier@iro.umontreal.ca>
* tmm.el (tmm-prompt): Remove obsolete call to x-popup-menu.
(tmm-get-keymap): Add key-binding shortcuts now that they're not
available in the "keyseq cache" any more.
* custom.el (defcustom): Add edebug spec. * custom.el (defcustom): Add edebug spec.
2010-04-18 Juri Linkov <juri@jurta.org> 2010-04-18 Juri Linkov <juri@jurta.org>

View File

@ -262,9 +262,6 @@ Its value should be an event that has a binding in MENU."
(condition-case nil (condition-case nil
(require 'mouse) (require 'mouse)
(error nil)) (error nil))
(condition-case nil
(x-popup-menu nil choice) ; Get the shortcuts
(error nil))
(tmm-prompt choice)) (tmm-prompt choice))
;; We just handled a menu keymap and found a command. ;; We just handled a menu keymap and found a command.
(choice (choice
@ -445,7 +442,7 @@ element of keymap, an `x-popup-menu' argument, or an element of
`x-popup-menu' argument (when IN-X-MENU is not-nil). `x-popup-menu' argument (when IN-X-MENU is not-nil).
This function adds the element only if it is not already present. This function adds the element only if it is not already present.
It uses the free variable `tmm-table-undef' to keep undefined keys." It uses the free variable `tmm-table-undef' to keep undefined keys."
(let (km str cache plist filter visible enable (event (car elt))) (let (km str plist filter visible enable (event (car elt)))
(setq elt (cdr elt)) (setq elt (cdr elt))
(if (eq elt 'undefined) (if (eq elt 'undefined)
(setq tmm-table-undef (cons (cons event nil) tmm-table-undef)) (setq tmm-table-undef (cons (cons event nil) tmm-table-undef))
@ -468,11 +465,7 @@ It uses the free variable `tmm-table-undef' to keep undefined keys."
(and (symbolp (cdr-safe (cdr-safe elt))) (and (symbolp (cdr-safe (cdr-safe elt)))
(fboundp (cdr-safe (cdr-safe elt))))) (fboundp (cdr-safe (cdr-safe elt)))))
(setq km (cddr elt)) (setq km (cddr elt))
(and (stringp (car elt)) (setq str (car elt))) (and (stringp (car elt)) (setq str (car elt))))
(and str
(stringp (cdr-safe (cadr elt))) ; keyseq cache
(setq cache (cdr (cadr elt)))
cache (setq str (concat str cache))))
((eq (car-safe elt) 'menu-item) ((eq (car-safe elt) 'menu-item)
;; (menu-item TITLE COMMAND KEY ...) ;; (menu-item TITLE COMMAND KEY ...)
@ -489,13 +482,7 @@ It uses the free variable `tmm-table-undef' to keep undefined keys."
(setq km (and (eval visible) km))) (setq km (and (eval visible) km)))
(setq enable (plist-get plist :enable)) (setq enable (plist-get plist :enable))
(if enable (if enable
(setq km (if (eval enable) km 'ignore))) (setq km (if (eval enable) km 'ignore))))
(and str
(consp (nth 3 elt))
(stringp (cdr (nth 3 elt))) ; keyseq cache
(setq cache (cdr (nth 3 elt)))
cache
(setq str (concat str cache))))
((if (listp (cdr-safe (cdr-safe (cdr-safe elt)))) ((if (listp (cdr-safe (cdr-safe (cdr-safe elt))))
(or (keymapp (cdr-safe (cdr-safe (cdr-safe elt)))) (or (keymapp (cdr-safe (cdr-safe (cdr-safe elt))))
@ -504,16 +491,25 @@ It uses the free variable `tmm-table-undef' to keep undefined keys."
(fboundp (cdr-safe (cdr-safe (cdr-safe elt)))))) (fboundp (cdr-safe (cdr-safe (cdr-safe elt))))))
; New style of easy-menu ; New style of easy-menu
(setq km (cdr (cddr elt))) (setq km (cdr (cddr elt)))
(and (stringp (car elt)) (setq str (car elt))) (and (stringp (car elt)) (setq str (car elt))))
(and str
(stringp (cdr-safe (car (cddr elt)))) ; keyseq cache
(setq cache (cdr (car (cdr (cdr elt)))))
cache (setq str (concat str cache))))
((stringp event) ; x-popup or x-popup element ((stringp event) ; x-popup or x-popup element
(if (or in-x-menu (stringp (car-safe elt))) (if (or in-x-menu (stringp (car-safe elt)))
(setq str event event nil km elt) (setq str event event nil km elt)
(setq str event event nil km (cons 'keymap elt)))))) (setq str event event nil km (cons 'keymap elt)))))
(unless (eq km 'ignore)
(let ((binding (where-is-internal km nil t)))
(when binding
(setq binding (key-description binding))
;; Try to align the keybindings.
(let ((colwidth (min 30 (- (/ (window-width) 2) 10))))
(setq str
(concat str
(make-string (max 2 (- colwidth
(string-width str)
(string-width binding)))
?\s)
binding)))))))
(and km (stringp km) (setq str km)) (and km (stringp km) (setq str km))
;; Verify that the command is enabled; ;; Verify that the command is enabled;
;; if not, don't mention it. ;; if not, don't mention it.