unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <monnier@iro.umontreal.ca>
Cc: Peter Heslin <public@heslin.eclipse.co.uk>, emacs-devel@gnu.org
Subject: Re: easymenu.el
Date: Sat, 06 Nov 2004 05:07:56 -0500	[thread overview]
Message-ID: <m1oeibberx.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1CQJ2J-0004WK-2N@fencepost.gnu.org> (Richard Stallman's message of "Sat, 06 Nov 2004 00:22:51 -0500")

> 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	other threads:[~2004-11-06 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-03 17:08 easymenu.el B. Anyos
2004-11-03 17:33 ` easymenu.el David Kastrup
2004-11-03 18:47   ` easymenu.el Stefan
2004-11-03 19:46     ` easymenu.el Peter Heslin
2004-11-06  5:22       ` easymenu.el Richard Stallman
2004-11-06 10:07         ` Stefan [this message]
2004-11-08 14:33           ` easymenu.el David Kastrup
2004-11-09 11:14             ` easymenu.el Richard Stallman
2004-11-09 11:18               ` easymenu.el David Kastrup
2004-11-09 21:30                 ` easymenu.el Richard Stallman
2004-11-09 22:11                   ` easymenu.el David Kastrup
2004-11-11  3:15                     ` easymenu.el Richard Stallman
2004-11-09 11:14           ` easymenu.el Richard Stallman
2004-11-09 11:21             ` easymenu.el David Kastrup
2004-11-09 14:26               ` easymenu.el Stefan
2004-11-06  5:22       ` easymenu.el Richard Stallman
2004-11-06 17:37         ` easymenu.el Vinicius Jose Latorre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1oeibberx.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=public@heslin.eclipse.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).