summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-05-12 03:41:19 +0000
committerMiles Bader <miles@gnu.org>2005-05-12 03:41:19 +0000
commit6919bf38d2d61b1d502a6548384a992c9106a66d (patch)
tree49a0d6d5a589029bc63ffdc42947c37e76e400e5 /lisp/emacs-lisp
parent608b34bf4ad0cd6e06215a4db25969d5391332cf (diff)
parent913d55fe7f6090b4ace4d910c397086607e4e878 (diff)
downloademacs-6919bf38d2d61b1d502a6548384a992c9106a66d.tar.gz
emacs-6919bf38d2d61b1d502a6548384a992c9106a66d.tar.bz2
emacs-6919bf38d2d61b1d502a6548384a992c9106a66d.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-51
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 289-301) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 68) - Update from CVS
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/byte-run.el33
-rw-r--r--lisp/emacs-lisp/cl-macs.el3
-rw-r--r--lisp/emacs-lisp/easy-mmode.el21
3 files changed, 41 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 5c92f247a05..1472d576e49 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -116,12 +116,16 @@ was first made obsolete, for example a date or a release number."
(defmacro define-obsolete-function-alias (function new
&optional when docstring)
- "Set FUNCTION's function definition to NEW and warn that FUNCTION is obsolete.
-If provided, WHEN should be a string indicating when FUNCTION was
-first made obsolete, for example a date or a release number. The
-optional argument DOCSTRING specifies the documentation string
-for FUNCTION; if DOCSTRING is omitted or nil, FUNCTION uses the
-documentation string of NEW unluess it already has one."
+ "Set FUNCTION's function definition to NEW and mark it obsolete.
+
+\(define-obsolete-function-alias 'old-fun 'new-fun \"22.1\" \"old-fun's doc.\")
+
+is equivalent to the following two lines of code:
+
+\(defalias 'old-fun 'new-fun \"old-fun's doc.\")
+\(make-obsolete 'old-fun 'new-fun \"22.1\")
+
+See the docstrings of `defalias' and `make-obsolete' for more details."
`(progn
(defalias ,function ,new ,docstring)
(make-obsolete ,function ,new ,when)))
@@ -143,12 +147,17 @@ was first made obsolete, for example a date or a release number."
(defmacro define-obsolete-variable-alias (variable new
&optional when docstring)
- "Make VARIABLE a variable alias for NEW and warn that VARIABLE is obsolete.
-If provided, WHEN should be a string indicating when VARIABLE was
-first made obsolete, for example a date or a release number. The
-optional argument DOCSTRING specifies the documentation string
-for VARIABLE; if DOCSTRING is omitted or nil, VARIABLE uses the
-documentation string of NEW unless it already has one."
+ "Make VARIABLE a variable alias for NEW and mark it obsolete.
+
+\(define-obsolete-variable-alias 'old-var 'new-var \"22.1\" \"old-var's doc.\")
+
+is equivalent to the following two lines of code:
+
+\(defvaralias 'old-var 'new-var \"old-var's doc.\")
+\(make-obsolete-variable 'old-var 'new-var \"22.1\")
+
+See the docstrings of `defvaralias' and `make-obsolete-variable' or
+Info node `(elisp)Variable Aliases' for more details."
`(progn
(defvaralias ,variable ,new ,docstring)
(make-obsolete-variable ,variable ,new ,when)))
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 305f0dd9587..137366c1c13 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)