/[emacs]/emacs/lisp/emacs-lisp/easymenu.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/easymenu.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.52 by rms, Sun Jul 7 09:56:08 2002 UTC revision 1.53 by monnier, Fri Aug 30 21:55:07 2002 UTC
# Line 187  In Emacs a menu filter must return a men Line 187  In Emacs a menu filter must return a men
187  return a menu items list (without menu name and keywords).  return a menu items list (without menu name and keywords).
188  This function returns the right thing in the two cases.  This function returns the right thing in the two cases.
189  If NAME is provided, it is used for the keymap."  If NAME is provided, it is used for the keymap."
190   (when (and (not (keymapp menu)) (consp menu))   (cond
191      ((and (not (keymapp menu)) (consp menu))
192     ;; If it's a cons but not a keymap, then it can't be right     ;; If it's a cons but not a keymap, then it can't be right
193     ;; unless it's an XEmacs menu.     ;; unless it's an XEmacs menu.
194     (setq menu (easy-menu-create-menu (or name "") menu)))     (setq menu (easy-menu-create-menu (or name "") menu)))
195   (easy-menu-get-map menu nil))          ; Get past indirections.    ((vectorp menu)
196       ;; It's just a menu entry.
197       (setq menu (cdr (easy-menu-convert-item menu)))))
198     menu)
199    
200  ;;;###autoload  ;;;###autoload
201  (defun easy-menu-create-menu (menu-name menu-items)  (defun easy-menu-create-menu (menu-name menu-items)
# Line 462  to implement dynamic menus." Line 466  to implement dynamic menus."
466  (defalias 'easy-menu-remove 'ignore)  (defalias 'easy-menu-remove 'ignore)
467    
468  (defun easy-menu-add (menu &optional map)  (defun easy-menu-add (menu &optional map)
469    "Maybe precalculate equivalent key bindings.    "Add the menu to the menubar.
470    This is a nop on Emacs since menus are automatically activated when the
471    corresponding keymap is activated.  On XEmacs this is needed to actually
472    add the menu to the current menubar.
473    Maybe precalculate equivalent key bindings.
474  Do it only if `easy-menu-precalculate-equivalent-keybindings' is on."  Do it only if `easy-menu-precalculate-equivalent-keybindings' is on."
475    (when easy-menu-precalculate-equivalent-keybindings    (when easy-menu-precalculate-equivalent-keybindings
476      (if (and (symbolp menu) (not (keymapp menu)) (boundp menu))      (if (and (symbolp menu) (not (keymapp menu)) (boundp menu))
# Line 565  If item is an old format item, a new for Line 573  If item is an old format item, a new for
573      (setq submap (cdr submap)))      (setq submap (cdr submap)))
574    submap)    submap)
575    
 ;; This should really be in keymap.c  
 (defun easy-menu-current-active-maps ()  
   (let ((maps (list (current-local-map) global-map)))  
     (dolist (minor minor-mode-map-alist)  
       (when (and (boundp (car minor))  
                  (symbol-value (car minor)))  
         (push (cdr minor) maps)))  
     (delq nil maps)))  
   
576  (defun easy-menu-get-map (map path &optional to-modify)  (defun easy-menu-get-map (map path &optional to-modify)
577    "Return a sparse keymap in which to add or remove an item.    "Return a sparse keymap in which to add or remove an item.
578  MAP and PATH are as defined in `easy-menu-add-item'.  MAP and PATH are as defined in `easy-menu-add-item'.
# Line 594  In some cases we use that to select betw Line 593  In some cases we use that to select betw
593                                     (list (if (and (symbolp map)                                     (list (if (and (symbolp map)
594                                                    (not (keymapp map)))                                                    (not (keymapp map)))
595                                               (symbol-value map) map))                                               (symbol-value map) map))
596                                   (easy-menu-current-active-maps)))))                                   (current-active-maps)))))
597              ;; Prefer a map that already contains the to-be-modified entry.              ;; Prefer a map that already contains the to-be-modified entry.
598              (when to-modify              (when to-modify
599                (dolist (map maps)                (dolist (map maps)

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26