From e6469973d4a91ec2a80b0a6abd176892874e1f9b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 7 May 2005 15:06:42 +0000 Subject: (easy-mmode-pretty-mode-name): Explain more about the LIGHTER arg's usage in the doc string. Add commentary to clarify what the code does. Fix the regexp that strips whitespace from LIGHTER. Quote LIGHTER before using it, since it could have characters special to regular expressions. --- lisp/emacs-lisp/easy-mmode.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 831ffb2d576..94db7cc586f 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -58,16 +58,29 @@ (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 + ;; "Foo-Bar-Minor" -> "Foo-Bar 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) -- cgit v1.2.3 From a5ad278d7512fe43201d214cbc2a534d93d5dc82 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 7 May 2005 15:46:21 +0000 Subject: (cl-transform-lambda): Recognize `declare' as well as `interactive', so that defmacro* would recognize `declare' forms. --- lisp/ChangeLog | 6 ++++++ lisp/emacs-lisp/cl-macs.el | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index da4e1c89976..fcf570a3413 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2005-05-07 Johan Bockg,Ae(Brd + + * emacs-lisp/cl-macs.el (cl-transform-lambda): Recognize `declare' + as well as `interactive', so that defmacro* would recognize + `declare' forms. + 2005-05-07 Eli Zaretskii * emacs-lisp/easy-mmode.el (easy-mmode-pretty-mode-name): Explain 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))))) -- cgit v1.2.3 From 906aee93915154417fa2b78d6fa6a869f7f1c71f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 8 May 2005 19:39:20 +0000 Subject: (easy-mmode-pretty-mode-name): Improve commentary. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/easy-mmode.el | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c5c345d9c0c..f7255a505aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2005-05-08 Eli Zaretskii + * emacs-lisp/easy-mmode.el (easy-mmode-pretty-mode-name): Improve + commentary. + * simple.el (next-error-overlay-arrow-position): Revert the change made on 2005-04-30. diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 94db7cc586f..a02f7be7d13 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -61,9 +61,11 @@ 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. + ;; Produce "Foo-Bar minor mode" from foo-bar-minor-mode. (name (concat (replace-regexp-in-string - ;; "Foo-Bar-Minor" -> "Foo-Bar minor" + ;; 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 -- cgit v1.2.3