summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2004-11-02 09:26:28 +0000
committerRichard M. Stallman <rms@gnu.org>2004-11-02 09:26:28 +0000
commitda6e3103c4143e18ed96c943b1519fc3e137ea66 (patch)
tree8e4904192ed85c5eceec466ba1868eb3dab45859 /lisp/emacs-lisp
parenta27235b3b5a9a6a31a8f33410186bd35328531e2 (diff)
downloademacs-da6e3103c4143e18ed96c943b1519fc3e137ea66.tar.gz
emacs-da6e3103c4143e18ed96c943b1519fc3e137ea66.tar.bz2
emacs-da6e3103c4143e18ed96c943b1519fc3e137ea66.zip
(easy-menu-intern):
Don't downcase; rather, case-flip the first letter of each word.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/easymenu.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index dbd7194f50a..e039b80aee5 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -42,7 +42,25 @@ menus, turn this variable off, otherwise it is probably better to keep it on."
: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)