# HG changeset patch # User Richard M. Stallman # Date 1099387588 0 # Node ID 4e4baf7bbf77185c3494bca01720968b0da5d036 # Parent 15493a81cb7850792c79fd1531310b14fcbf4212 (easy-menu-intern): Don't downcase; rather, case-flip the first letter of each word. diff -r 15493a81cb78 -r 4e4baf7bbf77 lisp/emacs-lisp/easymenu.el --- a/lisp/emacs-lisp/easymenu.el Tue Nov 02 09:23:34 2004 +0000 +++ b/lisp/emacs-lisp/easymenu.el Tue Nov 02 09:26:28 2004 +0000 @@ -42,7 +42,25 @@ :version "20.3") (defsubst easy-menu-intern (s) - (if (stringp s) (intern (downcase s)) 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)) ;;;###autoload (put 'easy-menu-define 'lisp-indent-function 'defun)