emacs-devel
[Top][All Lists]
Advanced

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

Re: easymenu.el


From: Stefan
Subject: Re: easymenu.el
Date: Sat, 06 Nov 2004 05:07:56 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> The reason I changed easy-menu-intern to alter the name is so that
> easy-menu would work with the standard menu items.  For instance, the
> Options menu uses `options' as the symbol.  I changed easy-menu-intern
> so it would convert "Options" into `options'.

> If we take out this change, then either (1) we have to change the
> symbols used in menu-bar.el, so that the Options menu uses `Options' as the
> symbol, or (2) easy-menu will not work with those menus any more.

Option (2) cannot really be true, because those things have never worked
with easy-menu (at least not in any released version of Emacs).

> If we do (1), then programs that call define-key to set up menu items
> in these menus will break.  However, I don't know how many of those
> programs there are.

Since this downcase-change is recent, only recently changed programs can
be affected and since we'd be getting back to Emacs-21.3 behavior, those
program would fail under Emacs-21.3 as well.

BTW, I've just installed a patch to easymenu that makes it look for
menu-item *names* when looking up keymaps, so you should now be able to say
(easy-menu-add-item nil '("File") ["foo" bar]) to add an entry "foo" in the
"File" menu even though that menu's key name is `files'.  As can be guessed
by the different spelling, this now works regardless of the actual
definition of easy-menu-intern, so I (re-)propose the additional patch below,


        Stefan


--- easymenu.el 06 Nov 2004 04:58:18 -0500      1.67
+++ easymenu.el 06 Nov 2004 05:06:15 -0500      
@@ -42,25 +42,7 @@
   :version "20.3")
 
 (defsubst easy-menu-intern (s)
-  (if (stringp s)
-      (let ((copy (copy-sequence s))
-           (pos 0)
-           found)
-       ;; For each letter that starts a word, flip its case.
-       ;; This way, the usual convention for menu strings (capitalized)
-       ;; corresponds to the usual convention for menu item event types
-       ;; (all lower case).  It's a 1-1 mapping so causes no conflicts.
-       (while (setq found (string-match "\\<\\sw" copy pos))
-         (setq pos (match-end 0))
-         (unless (= (upcase (aref copy found))
-                    (downcase (aref copy found)))
-           (aset copy found
-                 (if (= (upcase (aref copy found))
-                        (aref copy found))
-                     (downcase (aref copy found))
-                   (upcase (aref copy found))))))
-        (intern copy))
-    s))
+  (if (stringp s) (intern s) s))
 
 ;;;###autoload
 (put 'easy-menu-define 'lisp-indent-function 'defun)
@@ -437,8 +419,7 @@
                  (error nil))          ;`item' might not be a proper list.
                ;; Also check the string version of the symbol name,
                ;; for backwards compatibility.
-               (eq (car-safe item) (intern name))
-               (eq (car-safe item) (easy-menu-intern name)))))))
+               (eq (car-safe item) (intern name)))))))
 
 (defun easy-menu-always-true-p (x)
   "Return true if form X never evaluates to nil."




reply via email to

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