42 |
:version "20.3") |
:version "20.3") |
43 |
|
|
44 |
(defsubst easy-menu-intern (s) |
(defsubst easy-menu-intern (s) |
45 |
(if (stringp s) (intern (downcase s)) s)) |
(if (stringp s) |
46 |
|
(let ((copy (copy-sequence s)) |
47 |
|
(pos 0) |
48 |
|
found) |
49 |
|
;; For each letter that starts a word, flip its case. |
50 |
|
;; This way, the usual convention for menu strings (capitalized) |
51 |
|
;; corresponds to the usual convention for menu item event types |
52 |
|
;; (all lower case). It's a 1-1 mapping so causes no conflicts. |
53 |
|
(while (setq found (string-match "\\<\\sw" copy pos)) |
54 |
|
(setq pos (match-end 0)) |
55 |
|
(unless (= (upcase (aref copy found)) |
56 |
|
(downcase (aref copy found))) |
57 |
|
(aset copy found |
58 |
|
(if (= (upcase (aref copy found)) |
59 |
|
(aref copy found)) |
60 |
|
(downcase (aref copy found)) |
61 |
|
(upcase (aref copy found)))))) |
62 |
|
(intern copy)) |
63 |
|
s)) |
64 |
|
|
65 |
;;;###autoload |
;;;###autoload |
66 |
(put 'easy-menu-define 'lisp-indent-function 'defun) |
(put 'easy-menu-define 'lisp-indent-function 'defun) |