diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2005-05-09 16:13:15 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2005-05-09 16:13:15 +0000 |
commit | 85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd (patch) | |
tree | 85aebc58216ed19de18354b3d9974942eea621d5 /lisp/emacs-lisp | |
parent | c25b55138a36cf5f334070baf79ce61c1e956eed (diff) | |
parent | c7bda15b58de3efcf856786167f11f5b4175e30b (diff) | |
download | emacs-85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd.tar.gz emacs-85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd.tar.bz2 emacs-85dc59a9ff65aaf6b8e6a0c4452f74b7dade88fd.zip |
Merged from miles@gnu.org--gnu-2005 (patch 292-295)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-292
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-293
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-294
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-295
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-342
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 21 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4a46801763a..aae2fd9f3d8 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -233,7 +233,8 @@ ARGLIST allows full Common Lisp conventions." (bind-defs nil) (bind-enquote nil) (bind-inits nil) (bind-lets nil) (bind-forms nil) (header nil) (simple-args nil)) - (while (or (stringp (car body)) (eq (car-safe (car body)) 'interactive)) + (while (or (stringp (car body)) + (memq (car-safe (car body)) '(interactive declare))) (push (pop body) header)) (setq args (if (listp args) (copy-list args) (list '&rest args))) (let ((p (last args))) (if (cdr p) (setcdr p (list '&rest (cdr p))))) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 831ffb2d576..a02f7be7d13 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -58,16 +58,31 @@ (defun easy-mmode-pretty-mode-name (mode &optional lighter) "Turn the symbol MODE into a string intended for the user. -If provided LIGHTER will be used to help choose capitalization." +If provided, LIGHTER will be used to help choose capitalization by, +replacing its case-insensitive matches with the literal string in LIGHTER." (let* ((case-fold-search t) + ;; Produce "Foo-Bar minor mode" from foo-bar-minor-mode. (name (concat (replace-regexp-in-string + ;; If the original mode name included "-minor" (some + ;; of them don't, e.g. auto-revert-mode), then + ;; replace it with " minor". "-Minor" " minor" + ;; "foo-bar-minor" -> "Foo-Bar-Minor" (capitalize (replace-regexp-in-string + ;; "foo-bar-minor-mode" -> "foo-bar-minor" "-mode\\'" "" (symbol-name mode)))) " mode"))) (if (not (stringp lighter)) name - (setq lighter (replace-regexp-in-string "\\`\\s-+\\|\\-s+\\'" "" lighter)) - (replace-regexp-in-string lighter lighter name t t)))) + ;; Strip leading and trailing whitespace from LIGHTER. + (setq lighter (replace-regexp-in-string "\\`\\s-+\\|\\s-+\\'" "" + lighter)) + ;; Replace any (case-insensitive) matches for LIGHTER in NAME + ;; with a literal LIGHTER. E.g., if NAME is "Iimage mode" and + ;; LIGHTER is " iImag", then this will produce "iImage mode". + ;; (LIGHTER normally comes from the mode-line string passed to + ;; define-minor-mode, and normally includes at least one leading + ;; space.) + (replace-regexp-in-string (regexp-quote lighter) lighter name t t)))) ;;;###autoload (defalias 'easy-mmode-define-minor-mode 'define-minor-mode) |