emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easymenu.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easymenu.el
Date: Thu, 13 Dec 2001 14:03:13 -0500

Index: emacs/lisp/emacs-lisp/easymenu.el
diff -c emacs/lisp/emacs-lisp/easymenu.el:1.45 
emacs/lisp/emacs-lisp/easymenu.el:1.46
*** emacs/lisp/emacs-lisp/easymenu.el:1.45      Mon Jul 16 07:39:41 2001
--- emacs/lisp/emacs-lisp/easymenu.el   Thu Dec 13 14:03:12 2001
***************
*** 41,46 ****
--- 41,49 ----
    :group 'menu
    :version "20.3")
  
+ (defsubst easy-menu-intern (s)
+   (if (stringp s) (intern s) s))
+ 
  ;;;###autoload
  (put 'easy-menu-define 'lisp-indent-function 'defun)
  ;;;###autoload
***************
*** 167,173 ****
                                     (symbol-function ,symbol)))
                               ,symbol))))
      (mapcar (lambda (map)
!             (define-key map (vector 'menu-bar (intern (car menu)))
                (cons 'menu-item
                      (cons (car menu)
                            (if (not (symbolp keymap))
--- 170,176 ----
                                     (symbol-function ,symbol)))
                               ,symbol))))
      (mapcar (lambda (map)
!             (define-key map (vector 'menu-bar (easy-menu-intern (car menu)))
                (cons 'menu-item
                      (cons (car menu)
                            (if (not (symbolp keymap))
***************
*** 356,362 ****
      ;; `intern' the name so as to merge multiple entries with the same name.
      ;; It also makes it easier/possible to lookup/change menu bindings
      ;; via keymap functions.
!     (cons (if (stringp name) (intern name) name)
          (and (not remove)
               (cons 'menu-item
                     (cons label
--- 359,365 ----
      ;; `intern' the name so as to merge multiple entries with the same name.
      ;; It also makes it easier/possible to lookup/change menu bindings
      ;; via keymap functions.
!     (cons (easy-menu-intern name)
          (and (not remove)
               (cons 'menu-item
                     (cons label
***************
*** 365,372 ****
  
  (defun easy-menu-define-key-intern (menu key item &optional before)
    "Like easy-menu-define-key, but interns KEY and BEFORE if they are strings."
!   (easy-menu-define-key menu (if (stringp key) (intern key) key) item
!                       (if (stringp before) (intern before) before)))
  
  (defun easy-menu-define-key (menu key item &optional before)
    "Add binding in MENU for KEY => ITEM.  Similar to `define-key-after'.
--- 368,375 ----
  
  (defun easy-menu-define-key-intern (menu key item &optional before)
    "Like easy-menu-define-key, but interns KEY and BEFORE if they are strings."
!   (easy-menu-define-key menu (easy-menu-intern key) item
!                       (easy-menu-intern before)))
  
  (defun easy-menu-define-key (menu key item &optional before)
    "Add binding in MENU for KEY => ITEM.  Similar to `define-key-after'.
***************
*** 514,524 ****
    "In menu MENU try to look for menu item with name NAME.
  If a menu item is found, return (NAME . item), otherwise return nil.
  If item is an old format item, a new format item is returned."
!   (let ((item (lookup-key menu (vector (intern name))))
        ret enable cache label)
      (cond
-      ((or (keymapp item) (eq (car-safe item) 'menu-item))
-       (cons name item))                       ; Keymap or new menu format
       ((stringp (car-safe item))
        ;; This is the old menu format. Convert it to new format.
        (setq label (car item))
--- 517,525 ----
    "In menu MENU try to look for menu item with name NAME.
  If a menu item is found, return (NAME . item), otherwise return nil.
  If item is an old format item, a new format item is returned."
!   (let ((item (lookup-key menu (vector (easy-menu-intern name))))
        ret enable cache label)
      (cond
       ((stringp (car-safe item))
        ;; This is the old menu format. Convert it to new format.
        (setq label (car item))
***************
*** 532,538 ****
        (and (symbolp item) (setq enable (get item 'menu-enable))       ; Got 
enable
           (setq ret (cons :enable (cons enable ret))))
        (if cache (setq ret (cons cache ret)))
!       (cons name (cons 'menu-enable (cons label (cons item ret))))))))
  
  (defun easy-menu-get-map-look-for-name (name submap)
    (while (and submap (not (or (equal (car-safe (cdr-safe (car submap))) name)
--- 533,542 ----
        (and (symbolp item) (setq enable (get item 'menu-enable))       ; Got 
enable
           (setq ret (cons :enable (cons enable ret))))
        (if cache (setq ret (cons cache ret)))
!       (cons name (cons 'menu-enable (cons label (cons item ret)))))
!      (item ; (or (symbolp item) (keymapp item) (eq (car-safe item) 
'menu-item))
!       (cons name item))                       ; Keymap or new menu format
!      )))
  
  (defun easy-menu-get-map-look-for-name (name submap)
    (while (and submap (not (or (equal (car-safe (cdr-safe (car submap))) name)
***************
*** 558,564 ****
  In some cases we use that to select between the local and global maps."
    (setq map
        (catch 'found
!         (let* ((key (vconcat (unless map '(menu-bar)) (mapcar 'intern path)))
                 (maps (mapcar (lambda (map)
                                 (setq map (lookup-key map key))
                                 (while (and (symbolp map) (keymapp map))
--- 562,569 ----
  In some cases we use that to select between the local and global maps."
    (setq map
        (catch 'found
!         (let* ((key (vconcat (unless map '(menu-bar))
!                              (mapcar 'easy-menu-intern path)))
                 (maps (mapcar (lambda (map)
                                 (setq map (lookup-key map key))
                                 (while (and (symbolp map) (keymapp map))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]