mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 06:00:41 -08:00
(easy-menu-intern):
Don't downcase; rather, case-flip the first letter of each word.
This commit is contained in:
parent
a27235b3b5
commit
da6e3103c4
1 changed files with 19 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue