summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/byte-run.el12
-rw-r--r--lisp/emacs-lisp/easy-mmode.el4
-rw-r--r--lisp/emacs-lisp/eldoc.el24
-rw-r--r--lisp/emacs-lisp/generic.el70
4 files changed, 59 insertions, 51 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index ab7259b667f..5c92f247a05 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -114,6 +114,18 @@ was first made obsolete, for example a date or a release number."
(put function 'byte-obsolete-info (list new handler when)))
function)
+(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."
+ `(progn
+ (defalias ,function ,new ,docstring)
+ (make-obsolete ,function ,new ,when)))
+
(defun make-obsolete-variable (variable new &optional when)
"Make the byte-compiler warn that VARIABLE is obsolete.
The warning will say that NEW should be used instead.
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 01935c9d5e8..831ffb2d576 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -95,8 +95,8 @@ BODY contains code that will be executed each time the mode is (dis)activated.
will be passed to `defcustom' if the minor mode is global):
:group GROUP Custom group name to use in all generated `defcustom' forms.
Defaults to MODE without the possible trailing \"-mode\".
- (This default may not be a valid customization group defined
- with `defgroup'. Make sure it is.)
+ Don't use this default group name unless you have written a
+ `defgroup' to define that group properly.
:global GLOBAL If non-nil specifies that the minor mode is not meant to be
buffer-local, so don't make the variable MODE buffer-local.
By default, the mode is buffer-local.
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index f31dafb7b11..b23217151e3 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -45,7 +45,7 @@
;; Major modes for other languages may use Eldoc by defining an
;; appropriate function as the buffer-local value of
-;; `eldoc-print-current-symbol-info-function'.
+;; `eldoc-documentation-function'.
;;; Code:
@@ -139,16 +139,11 @@ truncated to make more of the arglist or documentation string visible."
;;;###autoload
(define-minor-mode eldoc-mode
"Toggle ElDoc mode on or off.
-Show the defined parameters for the elisp function near point.
-
-For the emacs lisp function at the beginning of the sexp which point is
-within, show the defined parameters for the function in the echo area.
-This information is extracted directly from the function or macro if it is
-in pure lisp. If the emacs function is a subr, the parameters are obtained
-from the documentation string if possible.
-
-If point is over a documented variable, print that variable's docstring
-instead.
+In ElDoc mode, the echo area displays information about a
+function or variable in the text where point is. If point is
+on a documented variable, it displays that variable's doc string.
+Otherwise it displays the argument list of the function called
+in the expression point is on.
With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
:group 'eldoc :lighter eldoc-minor-mode-string
@@ -167,7 +162,6 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
(eldoc-mode 1))
-;; Idle timers are part of Emacs 19.31 and later.
(defun eldoc-schedule-timer ()
(or (and eldoc-timer
(memq eldoc-timer timer-idle-list))
@@ -235,7 +229,7 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
(not (eq (selected-window) (minibuffer-window)))))
-(defvar eldoc-print-current-symbol-info-function nil
+(defvar eldoc-documentation-function nil
"If non-nil, function to call to return doc string.
The function of no args should return a one-line string for displaying
doc about a function etc. appropriate to the context around point.
@@ -249,8 +243,8 @@ Emacs Lisp mode) that support Eldoc.")
(defun eldoc-print-current-symbol-info ()
(condition-case err
(and (eldoc-display-message-p)
- (if eldoc-print-current-symbol-info-function
- (eldoc-message (funcall eldoc-print-current-symbol-info-function))
+ (if eldoc-documentation-function
+ (eldoc-message (funcall eldoc-documentation-function))
(let* ((current-symbol (eldoc-current-symbol))
(current-fnsym (eldoc-fnsym-in-current-sexp))
(doc (cond
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index 1bfa598a7c7..03f389aa4d1 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -35,15 +35,15 @@
;;
;; Each generic mode can define the following:
;;
-;; * List of comment-characters. The entries in this list should be
-;; either a character, a one or two character string or a cons pair.
-;; If the entry is a character or a string, it is added to the
-;; mode's syntax table with `comment-start' syntax. If the entry is
-;; a cons pair, the elements of the pair are considered to be
-;; `comment-start' and `comment-end' respectively. (The latter
-;; should be nil if you want comments to end at end of line.)
-;; LIMITATIONS: Emacs does not support comment strings of more than
-;; two characters in length.
+;; * List of comment-characters. The elements of this list should be
+;; either a character, a one or two character string, or a cons
+;; cell. If the entry is a character or a string, it is added to
+;; the mode's syntax table with "comment starter" syntax. If the
+;; entry is a cons cell, the `car' and `cdr' of the pair are
+;; considered the "comment starter" and "comment ender"
+;; respectively. (The latter should be nil if you want comments to
+;; end at the end of the line.) Emacs does not support comment
+;; strings of more than two characters in length.
;;
;; * List of keywords to font-lock. Each keyword should be a string.
;; If you have additional keywords which should be highlighted in a
@@ -121,40 +121,42 @@ instead (which see).")
&rest custom-keyword-args)
"Create a new generic mode MODE.
-MODE is the name of the command for the generic mode; it need not
-be quoted. The optional DOCSTRING is the documentation for the
-mode command. If you do not supply it, a default documentation
-string will be used instead.
+MODE is the name of the command for the generic mode; don't quote
+it. The optional DOCSTRING is the documentation for the mode
+command. If you do not supply it, `define-generic-mode' uses a
+default documentation string instead.
-COMMENT-LIST is a list, whose entries are either a single
-character, a one or two character string or a cons pair. If the
-entry is a character or a string, it is added to the mode's
-syntax table with `comment-start' syntax. If the entry is a cons
-pair, the elements of the pair are considered to be
-`comment-start' and `comment-end' respectively. (The latter
-should be nil if you want comments to end at end of line.) Note
-that Emacs has limitations regarding comment characters.
+COMMENT-LIST is a list in which each element is either a
+character, a string of one or two characters, or a cons cell. A
+character or a string is set up in the mode's syntax table as a
+\"comment starter\". If the entry is a cons cell, the `car' is
+set up as a \"comment starter\" and the `cdr' as a \"comment
+ender\". (Use nil for the latter if you want comments to end at
+the end of the line.) Note that the syntax table has limitations
+about what comment starters and enders are actually possible.
KEYWORD-LIST is a list of keywords to highlight with
`font-lock-keyword-face'. Each keyword should be a string.
FONT-LOCK-LIST is a list of additional expressions to highlight.
-Each entry in the list should have the same form as an entry in
-`font-lock-keywords'.
+Each element of this list should have the same form as an element
+of `font-lock-keywords'.
AUTO-MODE-LIST is a list of regular expressions to add to
-`auto-mode-alist'. These regexps are added to `auto-mode-alist'
-as soon as `define-generic-mode' is called.
+`auto-mode-alist'. These regular expressions are added when
+Emacs runs the macro expansion.
FUNCTION-LIST is a list of functions to call to do some
-additional setup.
+additional setup. The mode command calls these functions just
+before it runs the mode hook.
-The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and
-values. They will be passed to the generated `defcustom' form of
-the mode hook variable MODE-hook. Defaults to MODE without the
-possible trailing \"-mode\". (This default may not be a valid
-customization group defined with `defgroup'. Make sure it is.)
-You can specify keyword arguments without specifying a docstring.
+The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and values
+to include in the generated `defcustom' form for the mode hook
+variable `MODE-hook'. The default value for the `:group' keyword
+is MODE with the final \"-mode\" (if any) removed. (Don't use
+this default group name unless you have written a `defgroup' to
+define that group properly.) You can specify keyword arguments
+without specifying a docstring.
See the file generic-x.el for some examples of `define-generic-mode'."
(declare (debug (sexp def-form def-form def-form form def-form
@@ -178,7 +180,7 @@ See the file generic-x.el for some examples of `define-generic-mode'."
(unless (plist-get custom-keyword-args :group)
(setq custom-keyword-args
- (plist-put custom-keyword-args
+ (plist-put custom-keyword-args
:group `',(intern (replace-regexp-in-string
"-mode\\'" "" name)))))
@@ -226,7 +228,7 @@ See the file generic-x.el for some examples of `define-generic-mode'."
(when keyword-list
(push (concat "\\_<" (regexp-opt keyword-list t) "\\_>")
generic-font-lock-keywords))
- (setq font-lock-defaults '(generic-font-lock-keywords nil))
+ (setq font-lock-defaults '(generic-font-lock-keywords))
;; Call a list of functions
(mapcar 'funcall function-list)