aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/advice.el67
-rw-r--r--lisp/emacs-lisp/authors.el14
-rw-r--r--lisp/emacs-lisp/autoload.el473
-rw-r--r--lisp/emacs-lisp/avl-tree.el472
-rw-r--r--lisp/emacs-lisp/byte-opt.el17
-rw-r--r--lisp/emacs-lisp/bytecomp.el322
-rw-r--r--lisp/emacs-lisp/checkdoc.el12
-rw-r--r--lisp/emacs-lisp/cl-extra.el60
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el122
-rw-r--r--lisp/emacs-lisp/cl-macs.el77
-rw-r--r--lisp/emacs-lisp/cl-seq.el64
-rw-r--r--lisp/emacs-lisp/cl.el162
-rw-r--r--lisp/emacs-lisp/copyright.el45
-rw-r--r--lisp/emacs-lisp/cust-print.el52
-rw-r--r--lisp/emacs-lisp/derived.el6
-rw-r--r--lisp/emacs-lisp/disass.el2
-rw-r--r--lisp/emacs-lisp/easy-mmode.el2
-rw-r--r--lisp/emacs-lisp/easymenu.el40
-rw-r--r--lisp/emacs-lisp/edebug.el50
-rw-r--r--lisp/emacs-lisp/eldoc.el206
-rw-r--r--lisp/emacs-lisp/elint.el76
-rw-r--r--lisp/emacs-lisp/elp.el2
-rw-r--r--lisp/emacs-lisp/generic.el2
-rw-r--r--lisp/emacs-lisp/lisp-mode.el3
-rw-r--r--lisp/emacs-lisp/pp.el6
-rw-r--r--lisp/emacs-lisp/re-builder.el2
-rw-r--r--lisp/emacs-lisp/regi.el2
-rw-r--r--lisp/emacs-lisp/rx.el4
-rw-r--r--lisp/emacs-lisp/sregex.el2
29 files changed, 1598 insertions, 766 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index ed97c8786d..d04550c187 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -2467,27 +2467,11 @@ will clear the cache."
"Take a macro function DEFINITION and make a lambda out of it."
`(cdr ,definition))
-;; There is no way to determine whether some subr is a special form or not,
-;; hence we need this list (which is probably out of date):
-(defvar ad-special-forms
- (let ((tem '(and catch cond condition-case defconst defmacro
- defun defvar function if interactive let let*
- or prog1 prog2 progn quote save-current-buffer
- save-excursion save-restriction save-window-excursion
- setq setq-default unwind-protect while
- with-output-to-temp-buffer)))
- ;; track-mouse could be void in some configurations.
- (if (fboundp 'track-mouse)
- (push 'track-mouse tem))
- (mapcar 'symbol-function tem)))
-
-(defmacro ad-special-form-p (definition)
- ;;"non-nil if DEFINITION is a special form."
- (list 'memq definition 'ad-special-forms))
-
-(defmacro ad-interactive-p (definition)
- ;;"non-nil if DEFINITION can be called interactively."
- (list 'commandp definition))
+(defun ad-special-form-p (definition)
+ "Non-nil iff DEFINITION is a special form."
+ (if (and (symbolp definition) (fboundp definition))
+ (setq definition (indirect-function definition)))
+ (and (subrp definition) (eq (cdr (subr-arity definition)) 'unevalled)))
(defmacro ad-subr-p (definition)
;;"non-nil if DEFINITION is a subr."
@@ -2603,13 +2587,12 @@ that property, or otherwise use `(&rest ad-subr-args)'."
docstring)))
(defun ad-interactive-form (definition)
- "Return the interactive form of DEFINITION."
- (cond ((ad-compiled-p definition)
- (and (commandp definition)
- (list 'interactive (aref (ad-compiled-code definition) 5))))
- ((or (ad-advice-p definition)
- (ad-lambda-p definition))
- (commandp (ad-lambda-expression definition)))))
+ "Return the interactive form of DEFINITION.
+Like `interactive-form', but also works on pieces of advice."
+ (interactive-form
+ (if (ad-advice-p definition)
+ (ad-lambda-expression definition)
+ definition)))
(defun ad-body-forms (definition)
"Return the list of body forms of DEFINITION."
@@ -3013,7 +2996,9 @@ in any of these classes."
(setq usage (if (null usage) t (setq origdoc (cdr usage)) (car usage)))
(if origdoc (setq paragraphs (list origdoc)))
(unless (eq style 'plain)
- (push (concat "This " origtype " is advised.") paragraphs))
+ (push (propertize (concat "This " origtype " is advised.")
+ 'face 'font-lock-warning-face)
+ paragraphs))
(ad-dolist (class ad-advice-classes)
(ad-dolist (advice (ad-get-enabled-advices function class))
(setq advice-docstring
@@ -3063,7 +3048,7 @@ in any of these classes."
(ad-has-redefining-advice function))
(let* ((origdef (ad-real-orig-definition function))
(origname (ad-get-advice-info-field function 'origname))
- (orig-interactive-p (ad-interactive-p origdef))
+ (orig-interactive-p (commandp origdef))
(orig-subr-p (ad-subr-p origdef))
(orig-special-form-p (ad-special-form-p origdef))
(orig-macro-p (ad-macro-p origdef))
@@ -3075,15 +3060,11 @@ in any of these classes."
(interactive-form
(cond (orig-macro-p nil)
(advised-interactive-form)
- ((ad-interactive-form origdef)
- (if (and (symbolp function) (get function 'elp-info))
- (interactive-form (aref (get function 'elp-info) 2))
- (ad-interactive-form origdef)))
- ;; Otherwise we must have a subr: make it interactive if
- ;; we have to and initialize required arguments in case
- ;; it is called interactively:
- (orig-interactive-p
- (interactive-form origdef))))
+ ((interactive-form origdef)
+ (interactive-form
+ (if (and (symbolp function) (get function 'elp-info))
+ (aref (get function 'elp-info) 2)
+ origdef)))))
(orig-form
(cond ((or orig-special-form-p orig-macro-p)
;; Special forms and macros will be advised into macros.
@@ -3306,8 +3287,8 @@ advised definition from scratch."
t
(ad-arglist original-definition function))
(if (eq (ad-definition-type original-definition) 'function)
- (equal (ad-interactive-form original-definition)
- (ad-interactive-form cached-definition))))))
+ (equal (interactive-form original-definition)
+ (interactive-form cached-definition))))))
(defun ad-get-cache-class-id (function class)
"Return the part of FUNCTION's cache id that identifies CLASS."
@@ -3354,8 +3335,8 @@ advised definition from scratch."
(ad-arglist cached-definition))
(setq code 'interactive-form-mismatch)
(or (null (nth 5 cache-id))
- (equal (ad-interactive-form original-definition)
- (ad-interactive-form cached-definition)))
+ (equal (interactive-form original-definition)
+ (interactive-form cached-definition)))
(setq code 'verified))))
code))
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el
index 0c08e74d70..4b490621f5 100644
--- a/lisp/emacs-lisp/authors.el
+++ b/lisp/emacs-lisp/authors.el
@@ -72,7 +72,7 @@ files.")
("Geoff Voelker" "voelker")
("Gerd M,Av(Bllmann" "Gerd Moellmann")
("Hallvard B. Furuseth" "Hallvard B Furuseth")
- ("Hrvoje Nik,B9(Bi,Bf(B" "Hrvoje Niksic")
+ ("Hrvoje Nik$,1!!(Bi$,1 '(B" "Hrvoje Niksic")
(nil "<Use-Author-Address-Header@\\[127.1\\]>")
(nil "Code Extracted")
@@ -81,7 +81,7 @@ files.")
("Jaeyoun Chung" "Jae-youn Chung" "Jae-you Chung" "Chung Jae-youn")
("Jan Dj,Ad(Brv" "Jan D." "Jan Djarv")
("Jay K. Adams" "[email protected]" "Jay Adams")
- ("J,Ai(Br,At(Bme Marant" "J,bi(Br,bt(Bme Marant" "Jerome Marant")
+ ("J,Ai(Br,At(Bme Marant" "J,Ai(Br,At(Bme Marant" "Jerome Marant")
("Jens-Ulrik Holger Petersen" "Jens-Ulrik Petersen")
("Jeremy Bertram Maitin-Shepard" "Jeremy Maitin-Shepard")
("Johan Bockg,Ae(Brd" "Johan Bockgard")
@@ -90,11 +90,11 @@ files.")
("Joseph Arceneaux" "Joe Arceneaux")
("Juan Le,As(Bn Lahoz Garc,Am(Ba" "Juan-Leon Lahoz Garcia")
("K. Shane Hartman" "Shane Hartman")
- ("Kai Gro,A_(Bjohann" "Kai Grossjohann" "Kai Gro,b_(Bjohann"
+ ("Kai Gro,A_(Bjohann" "Kai Grossjohann" "Kai Gro,A_(Bjohann"
("Karl Berry" "K. Berry")
- ("K,Aa(Broly L$,1 q(Brentey" "K,Aa(Broly L,Bu(Brentey" "L$,1 q(Brentey K,Aa(Broly")
+ ("K,Aa(Broly L$,1 q(Brentey" "K,Aa(Broly L$,1 q(Brentey" "L$,1 q(Brentey K,Aa(Broly")
("Kazushi Marukawa" "Kazushi")
("Ken Manheimer" "Kenneth Manheimer")
("Kenichi Handa" "Ken'ichi Handa" "Kenichi HANDA")
@@ -113,7 +113,7 @@ files.")
("Mikio Nakajima" "Nakajima Mikio")
("Paul Eggert" "eggert")
("Paul Reilly" "([email protected])")
- ("Pavel Jan,Bm(Bk" "Pavel Jan,Am(Bk Ml." "Pavel Jan,Am(Bk" "[email protected]")
+ ("Pavel Jan,Am(Bk" "Pavel Jan,Am(Bk Ml." "Pavel Jan,Am(Bk" "[email protected]")
("Per Abrahamsen" "Per Abhiddenware")
("Peter S. Galbraith" "Peter Galbraith")
("Peter Runestig" "Peter 'luna' Runestig")
@@ -666,8 +666,8 @@ list of their contributions.\n")
(erase-buffer)
(set-buffer-file-coding-system authors-coding-system)
(insert "Unrecognized file entries found:\n\n")
- (mapcar (lambda (f) (if (not (string-match "^[A-Za-z]+$" f)) (insert f "\n")))
- (sort authors-invalid-file-names 'string-lessp))
+ (mapc (lambda (f) (if (not (string-match "^[A-Za-z]+$" f)) (insert f "\n")))
+ (sort authors-invalid-file-names 'string-lessp))
(goto-char (point-min))
(compilation-mode)
(message "Errors were found. See buffer %s" (buffer-name))))
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index ee6c229b74..14877e1b18 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -41,15 +41,19 @@
A `.el' file can set this in its local variables section to make its
autoloads go somewhere else. The autoload file is assumed to contain a
trailer starting with a FormFeed character.")
+;;;###autoload
+(put 'generated-autoload-file 'safe-local-variable 'stringp)
-(defconst generate-autoload-cookie ";;;###autoload"
+;; This feels like it should be a defconst, but MH-E sets it to
+;; ";;;###mh-autoload" for the autoloads that are to go into mh-loaddefs.el.
+(defvar generate-autoload-cookie ";;;###autoload"
"Magic comment indicating the following form should be autoloaded.
Used by \\[update-file-autoloads]. This string should be
meaningless to Lisp (e.g., a comment).
This string is used:
-;;;###autoload
+\;;;###autoload
\(defun function-to-be-autoloaded () ...)
If this string appears alone on a line, the following form will be
@@ -65,6 +69,8 @@ that text will be copied verbatim to `generated-autoload-file'.")
(defconst generate-autoload-section-continuation ";;;;;; "
"String to add on each continuation of the section header form.")
+(defvar autoload-modified-buffers) ;Dynamically scoped var.
+
(defun make-autoload (form file)
"Turn FORM into an autoload or defvar for source file FILE.
Returns nil if FORM is not a special autoload form (i.e. a function definition
@@ -149,16 +155,14 @@ or macro definition or a defcustom)."
;; the doc-string in FORM.
;; Those properties are now set in lisp-mode.el.
+(defun autoload-generated-file ()
+ (expand-file-name generated-autoload-file
+ ;; File-local settings of generated-autoload-file should
+ ;; be interpreted relative to the file's location,
+ ;; of course.
+ (if (not (local-variable-p 'generated-autoload-file))
+ (expand-file-name "lisp" source-directory))))
-(defun autoload-trim-file-name (file)
- ;; Returns a relative file path for FILE
- ;; starting from the directory that loaddefs.el is in.
- ;; That is normally a directory in load-path,
- ;; which means Emacs will be able to find FILE when it looks.
- ;; Any extra directory names here would prevent finding the file.
- (setq file (expand-file-name file))
- (file-relative-name file
- (file-name-directory generated-autoload-file)))
(defun autoload-read-section-header ()
"Read a section header form.
@@ -205,6 +209,7 @@ put the output in."
(setcdr p nil)
(princ "\n(" outbuf)
(let ((print-escape-newlines t)
+ (print-quoted t)
(print-escape-nonascii t))
(dolist (elt form)
(prin1 elt outbuf)
@@ -228,6 +233,7 @@ put the output in."
outbuf))
(terpri outbuf)))
(let ((print-escape-newlines t)
+ (print-quoted t)
(print-escape-nonascii t))
(print form outbuf)))))))
@@ -253,9 +259,7 @@ put the output in."
"Insert the section-header line,
which lists the file name and which functions are in it, etc."
(insert generate-autoload-section-header)
- (prin1 (list 'autoloads autoloads load-name
- (if (stringp file) (autoload-trim-file-name file) file)
- time)
+ (prin1 (list 'autoloads autoloads load-name file time)
outbuf)
(terpri outbuf)
;; Break that line at spaces, to avoid very long lines.
@@ -272,12 +276,14 @@ which lists the file name and which functions are in it, etc."
(defun autoload-find-file (file)
"Fetch file and put it in a temp buffer. Return the buffer."
;; It is faster to avoid visiting the file.
+ (setq file (expand-file-name file))
(with-current-buffer (get-buffer-create " *autoload-file*")
(kill-all-local-variables)
(erase-buffer)
(setq buffer-undo-list t
buffer-read-only nil)
(emacs-lisp-mode)
+ (setq default-directory (file-name-directory file))
(insert-file-contents file nil)
(let ((enable-local-variables :safe))
(hack-local-variables))
@@ -286,6 +292,12 @@ which lists the file name and which functions are in it, etc."
(defvar no-update-autoloads nil
"File local variable to prevent scanning this file for autoload cookies.")
+(defun autoload-file-load-name (file)
+ (let ((name (file-name-nondirectory file)))
+ (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
+ (substring name 0 (match-beginning 0))
+ name)))
+
(defun generate-file-autoloads (file)
"Insert at point a loaddefs autoload section for FILE.
Autoloads are generated for defuns and defmacros in FILE
@@ -294,100 +306,155 @@ If FILE is being visited in a buffer, the contents of the buffer
are used.
Return non-nil in the case where no autoloads were added at point."
(interactive "fGenerate autoloads for file: ")
- (let ((outbuf (current-buffer))
- (autoloads-done '())
- (load-name (let ((name (file-name-nondirectory file)))
- (if (string-match "\\.elc?\\(\\.\\|$\\)" name)
- (substring name 0 (match-beginning 0))
- name)))
- (print-length nil)
- (print-readably t) ; This does something in Lucid Emacs.
- (float-output-format nil)
- (done-any nil)
- (visited (get-file-buffer file))
- output-start)
-
- ;; If the autoload section we create here uses an absolute
- ;; file name for FILE in its header, and then Emacs is installed
- ;; under a different path on another system,
- ;; `update-autoloads-here' won't be able to find the files to be
- ;; autoloaded. So, if FILE is in the same directory or a
- ;; subdirectory of the current buffer's directory, we'll make it
- ;; relative to the current buffer's directory.
- (setq file (expand-file-name file))
- (let* ((source-truename (file-truename file))
- (dir-truename (file-name-as-directory
- (file-truename default-directory)))
- (len (length dir-truename)))
- (if (and (< len (length source-truename))
- (string= dir-truename (substring source-truename 0 len)))
- (setq file (substring source-truename len))))
-
- (with-current-buffer (or visited
- ;; It is faster to avoid visiting the file.
- (autoload-find-file file))
- ;; Obey the no-update-autoloads file local variable.
- (unless no-update-autoloads
- (message "Generating autoloads for %s..." file)
- (setq output-start (with-current-buffer outbuf (point)))
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- (while (not (eobp))
- (skip-chars-forward " \t\n\f")
- (cond
- ((looking-at (regexp-quote generate-autoload-cookie))
- (search-forward generate-autoload-cookie)
- (skip-chars-forward " \t")
- (setq done-any t)
- (if (eolp)
- ;; Read the next form and make an autoload.
- (let* ((form (prog1 (read (current-buffer))
- (or (bolp) (forward-line 1))))
- (autoload (make-autoload form load-name)))
- (if autoload
- (push (nth 1 form) autoloads-done)
- (setq autoload form))
- (let ((autoload-print-form-outbuf outbuf))
- (autoload-print-form autoload)))
-
- ;; Copy the rest of the line to the output.
- (princ (buffer-substring
- (progn
- ;; Back up over whitespace, to preserve it.
- (skip-chars-backward " \f\t")
- (if (= (char-after (1+ (point))) ? )
- ;; Eat one space.
- (forward-char 1))
- (point))
- (progn (forward-line 1) (point)))
- outbuf)))
- ((looking-at ";")
- ;; Don't read the comment.
- (forward-line 1))
- (t
- (forward-sexp 1)
- (forward-line 1))))))
-
- (when done-any
- (with-current-buffer outbuf
- (save-excursion
- ;; Insert the section-header line which lists the file name
- ;; and which functions are in it, etc.
- (goto-char output-start)
- (autoload-insert-section-header
- outbuf autoloads-done load-name file
- (nth 5 (file-attributes file)))
- (insert ";;; Generated autoloads from "
- (autoload-trim-file-name file) "\n"))
- (insert generate-autoload-section-trailer)))
- (message "Generating autoloads for %s...done" file))
- (or visited
- ;; We created this buffer, so we should kill it.
- (kill-buffer (current-buffer))))
- (not done-any)))
+ (autoload-generate-file-autoloads file (current-buffer)))
+
+;; When called from `generate-file-autoloads' we should ignore
+;; `generated-autoload-file' altogether. When called from
+;; `update-file-autoloads' we don't know `outbuf'. And when called from
+;; `update-directory-autoloads' it's in between: we know the default
+;; `outbuf' but we should obey any file-local setting of
+;; `generated-autoload-file'.
+(defun autoload-generate-file-autoloads (file &optional outbuf outfile)
+ "Insert an autoload section for FILE in the appropriate buffer.
+Autoloads are generated for defuns and defmacros in FILE
+marked by `generate-autoload-cookie' (which see).
+If FILE is being visited in a buffer, the contents of the buffer are used.
+OUTBUF is the buffer in which the autoload statements should be inserted.
+If OUTBUF is nil, it will be determined by `autoload-generated-file'.
+
+If provided, OUTFILE is expected to be the file name of OUTBUF.
+If OUTFILE is non-nil and FILE specifies a `generated-autoload-file'
+different from OUTFILE, then OUTBUF is ignored.
+
+Return non-nil iff FILE adds no autoloads to OUTFILE
+\(or OUTBUF if OUTFILE is nil)."
+ (catch 'done
+ (let ((autoloads-done '())
+ (load-name (autoload-file-load-name file))
+ (print-length nil)
+ (print-readably t) ; This does something in Lucid Emacs.
+ (float-output-format nil)
+ (visited (get-file-buffer file))
+ (otherbuf nil)
+ (absfile (expand-file-name file))
+ relfile
+ ;; nil until we found a cookie.
+ output-start)
+
+ (with-current-buffer (or visited
+ ;; It is faster to avoid visiting the file.
+ (autoload-find-file file))
+ ;; Obey the no-update-autoloads file local variable.
+ (unless no-update-autoloads
+ (message "Generating autoloads for %s..." file)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (skip-chars-forward " \t\n\f")
+ (cond
+ ((looking-at (regexp-quote generate-autoload-cookie))
+ ;; If not done yet, figure out where to insert this text.
+ (unless output-start
+ (when (and outfile
+ (not (equal outfile (autoload-generated-file))))
+ ;; A file-local setting of autoload-generated-file says
+ ;; we should ignore OUTBUF.
+ (setq outbuf nil)
+ (setq otherbuf t))
+ (unless outbuf
+ (setq outbuf (autoload-find-destination absfile))
+ (unless outbuf
+ ;; The file has autoload cookies, but they're
+ ;; already up-to-date. If OUTFILE is nil, the
+ ;; entries are in the expected OUTBUF, otherwise
+ ;; they're elsewhere.
+ (throw 'done outfile)))
+ (with-current-buffer outbuf
+ (setq relfile (file-relative-name absfile))
+ (setq output-start (point)))
+ ;; (message "file=%S, relfile=%S, dest=%S"
+ ;; file relfile (autoload-generated-file))
+ )
+ (search-forward generate-autoload-cookie)
+ (skip-chars-forward " \t")
+ (if (eolp)
+ (condition-case err
+ ;; Read the next form and make an autoload.
+ (let* ((form (prog1 (read (current-buffer))
+ (or (bolp) (forward-line 1))))
+ (autoload (make-autoload form load-name)))
+ (if autoload
+ (push (nth 1 form) autoloads-done)
+ (setq autoload form))
+ (let ((autoload-print-form-outbuf outbuf))
+ (autoload-print-form autoload)))
+ (error
+ (message "Error in %s: %S" file err)))
+
+ ;; Copy the rest of the line to the output.
+ (princ (buffer-substring
+ (progn
+ ;; Back up over whitespace, to preserve it.
+ (skip-chars-backward " \f\t")
+ (if (= (char-after (1+ (point))) ? )
+ ;; Eat one space.
+ (forward-char 1))
+ (point))
+ (progn (forward-line 1) (point)))
+ outbuf)))
+ ((looking-at ";")
+ ;; Don't read the comment.
+ (forward-line 1))
+ (t
+ (forward-sexp 1)
+ (forward-line 1))))))
+
+ (when output-start
+ (let ((secondary-autoloads-file-buf
+ (if (local-variable-p 'generated-autoload-file)
+ (current-buffer))))
+ (with-current-buffer outbuf
+ (save-excursion
+ ;; Insert the section-header line which lists the file name
+ ;; and which functions are in it, etc.
+ (goto-char output-start)
+ (autoload-insert-section-header
+ outbuf autoloads-done load-name relfile
+ (if secondary-autoloads-file-buf
+ ;; MD5 checksums are much better because they do not
+ ;; change unless the file changes (so they'll be
+ ;; equal on two different systems and will change
+ ;; less often than time-stamps, thus leading to fewer
+ ;; unneeded changes causing spurious conflicts), but
+ ;; using time-stamps is a very useful optimization,
+ ;; so we use time-stamps for the main autoloads file
+ ;; (loaddefs.el) where we have special ways to
+ ;; circumvent the "random change problem", and MD5
+ ;; checksum in secondary autoload files where we do
+ ;; not need the time-stamp optimization because it is
+ ;; already provided by the primary autoloads file.
+ (md5 secondary-autoloads-file-buf
+ ;; We'd really want to just use
+ ;; `emacs-internal' instead.
+ nil nil 'emacs-mule-unix)
+ (nth 5 (file-attributes relfile))))
+ (insert ";;; Generated autoloads from " relfile "\n"))
+ (insert generate-autoload-section-trailer))))
+ (message "Generating autoloads for %s...done" file))
+ (or visited
+ ;; We created this buffer, so we should kill it.
+ (kill-buffer (current-buffer))))
+ ;; If the entries were added to some other buffer, then the file
+ ;; doesn't add entries to OUTFILE.
+ (or (not output-start) otherbuf))))
+(defun autoload-save-buffers ()
+ (while autoload-modified-buffers
+ (with-current-buffer (pop autoload-modified-buffers)
+ (save-buffer))))
+
;;;###autoload
(defun update-file-autoloads (file &optional save-after)
"Update the autoloads for FILE in `generated-autoload-file'
@@ -397,80 +464,80 @@ save the buffer too.
Return FILE if there was no autoload cookie in it, else nil."
(interactive "fUpdate autoloads for file: \np")
- (let ((load-name (let ((name (file-name-nondirectory file)))
- (if (string-match "\\.elc?\\(\\.\\|$\\)" name)
- (substring name 0 (match-beginning 0))
- name)))
- (found nil)
- (existing-buffer (get-file-buffer file))
- (no-autoloads nil))
- (save-excursion
- ;; We want to get a value for generated-autoload-file from
- ;; the local variables section if it's there.
- (if existing-buffer
- (set-buffer existing-buffer))
- ;; We must read/write the file without any code conversion,
- ;; but still decode EOLs.
- (let ((coding-system-for-read 'raw-text))
- (set-buffer (find-file-noselect
- (autoload-ensure-default-file
- (expand-file-name generated-autoload-file
- (expand-file-name "lisp"
- source-directory)))))
- ;; This is to make generated-autoload-file have Unix EOLs, so
- ;; that it is portable to all platforms.
- (setq buffer-file-coding-system 'raw-text-unix))
- (or (> (buffer-size) 0)
- (error "Autoloads file %s does not exist" buffer-file-name))
- (or (file-writable-p buffer-file-name)
- (error "Autoloads file %s is not writable" buffer-file-name))
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- ;; Look for the section for LOAD-NAME.
- (while (and (not found)
- (search-forward generate-autoload-section-header nil t))
- (let ((form (autoload-read-section-header)))
- (cond ((string= (nth 2 form) load-name)
- ;; We found the section for this file.
- ;; Check if it is up to date.
- (let ((begin (match-beginning 0))
- (last-time (nth 4 form))
- (file-time (nth 5 (file-attributes file))))
- (if (and (or (null existing-buffer)
- (not (buffer-modified-p existing-buffer)))
- (listp last-time) (= (length last-time) 2)
- (not (time-less-p last-time file-time)))
- (progn
- (if (interactive-p)
- (message "\
-Autoload section for %s is up to date."
- file))
- (setq found 'up-to-date))
- (search-forward generate-autoload-section-trailer)
- (delete-region begin (point))
- (setq found t))))
- ((string< load-name (nth 2 form))
- ;; We've come to a section alphabetically later than
- ;; LOAD-NAME. We assume the file is in order and so
- ;; there must be no section for LOAD-NAME. We will
- ;; insert one before the section here.
- (goto-char (match-beginning 0))
- (setq found 'new)))))
- (or found
- (progn
- (setq found 'new)
- ;; No later sections in the file. Put before the last page.
- (goto-char (point-max))
- (search-backward "\f" nil t)))
- (or (eq found 'up-to-date)
- (setq no-autoloads (generate-file-autoloads file)))))
- (and save-after
- (buffer-modified-p)
- (save-buffer))
-
- (if no-autoloads file))))
+ (let* ((autoload-modified-buffers nil)
+ (no-autoloads (autoload-generate-file-autoloads file)))
+ (if autoload-modified-buffers
+ (if save-after (autoload-save-buffers))
+ (if (interactive-p)
+ (message "Autoload section for %s is up to date." file)))
+ (if no-autoloads file)))
+
+(defun autoload-find-destination (file)
+ "Find the destination point of the current buffer's autoloads.
+FILE is the file name of the current buffer.
+Returns a buffer whose point is placed at the requested location.
+Returns nil if the file's autoloads are uptodate, otherwise
+removes any prior now out-of-date autoload entries."
+ (catch 'up-to-date
+ (let* ((load-name (autoload-file-load-name file))
+ (buf (current-buffer))
+ (existing-buffer (if buffer-file-name buf))
+ (found nil))
+ (with-current-buffer
+ ;; We must read/write the file without any code conversion,
+ ;; but still decode EOLs.
+ (let ((coding-system-for-read 'raw-text))
+ (find-file-noselect
+ (autoload-ensure-default-file (autoload-generated-file))))
+ ;; This is to make generated-autoload-file have Unix EOLs, so
+ ;; that it is portable to all platforms.
+ (setq buffer-file-coding-system 'raw-text-unix)
+ (or (> (buffer-size) 0)
+ (error "Autoloads file %s does not exist" buffer-file-name))
+ (or (file-writable-p buffer-file-name)
+ (error "Autoloads file %s is not writable" buffer-file-name))
+ (widen)
+ (goto-char (point-min))
+ ;; Look for the section for LOAD-NAME.
+ (while (and (not found)
+ (search-forward generate-autoload-section-header nil t))
+ (let ((form (autoload-read-section-header)))
+ (cond ((string= (nth 2 form) load-name)
+ ;; We found the section for this file.
+ ;; Check if it is up to date.
+ (let ((begin (match-beginning 0))
+ (last-time (nth 4 form))
+ (file-time (nth 5 (file-attributes file))))
+ (if (and (or (null existing-buffer)
+ (not (buffer-modified-p existing-buffer)))
+ (or
+ ;; last-time is the time-stamp (specifying
+ ;; the last time we looked at the file) and
+ ;; the file hasn't been changed since.
+ (and (listp last-time) (= (length last-time) 2)
+ (not (time-less-p last-time file-time)))
+ ;; last-time is an MD5 checksum instead.
+ (and (stringp last-time)
+ (equal last-time
+ (md5 buf nil nil 'emacs-mule)))))
+ (throw 'up-to-date nil)
+ (autoload-remove-section begin)
+ (setq found t))))
+ ((string< load-name (nth 2 form))
+ ;; We've come to a section alphabetically later than
+ ;; LOAD-NAME. We assume the file is in order and so
+ ;; there must be no section for LOAD-NAME. We will
+ ;; insert one before the section here.
+ (goto-char (match-beginning 0))
+ (setq found t)))))
+ (or found
+ (progn
+ ;; No later sections in the file. Put before the last page.
+ (goto-char (point-max))
+ (search-backward "\f" nil t)))
+ (unless (memq (current-buffer) autoload-modified-buffers)
+ (push (current-buffer) autoload-modified-buffers))
+ (current-buffer)))))
(defun autoload-remove-section (begin)
(goto-char begin)
@@ -498,20 +565,21 @@ directory or directories specified."
(directory-files (expand-file-name dir)
t files-re))
dirs)))
+ (done ())
(this-time (current-time))
- (no-autoloads nil) ;files with no autoload cookies.
- (autoloads-file
- (expand-file-name generated-autoload-file
- (expand-file-name "lisp" source-directory)))
- (top-dir (file-name-directory autoloads-file)))
+ ;; Files with no autoload cookies or whose autoloads go to other
+ ;; files because of file-local autoload-generated-file settings.
+ (no-autoloads nil)
+ (autoload-modified-buffers nil))
(with-current-buffer
- (find-file-noselect (autoload-ensure-default-file autoloads-file))
+ (find-file-noselect
+ (autoload-ensure-default-file (autoload-generated-file)))
(save-excursion
;; Canonicalize file names and remove the autoload file itself.
- (setq files (delete (autoload-trim-file-name buffer-file-name)
- (mapcar 'autoload-trim-file-name files)))
+ (setq files (delete (file-relative-name buffer-file-name)
+ (mapcar 'file-relative-name files)))
(goto-char (point-min))
(while (search-forward generate-autoload-section-header nil t)
@@ -531,19 +599,27 @@ directory or directories specified."
(push file no-autoloads)
(setq files (delete file files)))))))
((not (stringp file)))
- ((not (file-exists-p (expand-file-name file top-dir)))
- ;; Remove the obsolete section.
+ ((or (not (file-exists-p file))
+ ;; Remove duplicates as well, just in case.
+ (member file done))
+ ;; Remove the obsolete section.
(autoload-remove-section (match-beginning 0)))
- ((equal (nth 4 form) (nth 5 (file-attributes file)))
+ ((not (time-less-p (nth 4 form)
+ (nth 5 (file-attributes file))))
;; File hasn't changed.
nil)
(t
- (update-file-autoloads file)))
+ (autoload-remove-section (match-beginning 0))
+ (if (autoload-generate-file-autoloads
+ file (current-buffer) buffer-file-name)
+ (push file no-autoloads))))
+ (push file done)
(setq files (delete file files)))))
;; Elements remaining in FILES have no existing autoload sections yet.
- (setq no-autoloads
- (append no-autoloads
- (delq nil (mapcar 'update-file-autoloads files))))
+ (dolist (file files)
+ (if (autoload-generate-file-autoloads file nil buffer-file-name)
+ (push file no-autoloads)))
+
(when no-autoloads
;; Sort them for better readability.
(setq no-autoloads (sort no-autoloads 'string<))
@@ -554,7 +630,10 @@ directory or directories specified."
(current-buffer) nil nil no-autoloads this-time)
(insert generate-autoload-section-trailer))
- (save-buffer))))
+ (save-buffer)
+ ;; In case autoload entries were added to other files because of
+ ;; file-local autoload-generated-file settings.
+ (autoload-save-buffers))))
(define-obsolete-function-alias 'update-autoloads-from-directories
'update-directory-autoloads "22.1")
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
new file mode 100644
index 0000000000..b8cf836238
--- /dev/null
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -0,0 +1,472 @@
+;;; avl-tree.el --- balanced binary trees, AVL-trees
+
+;; Copyright (C) 1995, 2007 Free Software Foundation, Inc.
+
+;; Author: Per Cederqvist <[email protected]>
+;; Inge Wallin <[email protected]>
+;; Thomas Bellman <[email protected]>
+;; Maintainer: FSF
+;; Created: 10 May 1991
+;; Keywords: extensions, data structures
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; An AVL tree is a nearly-perfect balanced binary tree. A tree consists of
+;; two elements, the root node and the compare function. The actual tree
+;; has a dummy node as its root with the real root in the left pointer.
+;;
+;; Each node of the tree consists of one data element, one left
+;; sub-tree and one right sub-tree. Each node also has a balance
+;; count, which is the difference in depth of the left and right
+;; sub-trees.
+;;
+;; The functions with names of the form "avl-tree--" are intended for
+;; internal use only.
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+;; ================================================================
+;;; Functions and macros handling an AVL tree node.
+
+(defstruct (avl-tree--node
+ ;; We force a representation without tag so it matches the
+ ;; pre-defstruct representation. Also we use the underlying
+ ;; representation in the implementation of avl-tree--node-branch.
+ (:type vector)
+ (:constructor nil)
+ (:constructor avl-tree--node-create (left right data balance))
+ (:copier nil))
+ left right data balance)
+
+(defalias 'avl-tree--node-branch 'aref
+ ;; This implementation is efficient but breaks the defstruct abstraction.
+ ;; An alternative could be
+ ;; (funcall (aref [avl-tree-left avl-tree-right avl-tree-data] branch) node)
+ "Get value of a branch of a node.
+
+NODE is the node, and BRANCH is the branch.
+0 for left pointer, 1 for right pointer and 2 for the data.\"
+\(fn node branch)")
+;; The funcall/aref trick doesn't work for the setf method, unless we try
+;; and access the underlying setter function, but this wouldn't be
+;; portable either.
+(defsetf avl-tree--node-branch aset)
+
+
+;; ================================================================
+;;; Internal functions for use in the AVL tree package
+
+(defstruct (avl-tree-
+ ;; A tagged list is the pre-defstruct representation.
+ ;; (:type list)
+ :named
+ (:constructor nil)
+ (:constructor avl-tree-create (cmpfun))
+ (:predicate avl-tree-p)
+ (:copier nil))
+ (dummyroot (avl-tree--node-create nil nil nil 0))
+ cmpfun)
+
+(defmacro avl-tree--root (tree)
+ ;; Return the root node for an avl-tree. INTERNAL USE ONLY.
+ `(avl-tree--node-left (avl-tree--dummyroot tree)))
+(defsetf avl-tree--root (tree) (node)
+ `(setf (avl-tree--node-left (avl-tree--dummyroot ,tree)) ,node))
+
+;; ----------------------------------------------------------------
+;; Deleting data
+
+(defun avl-tree--del-balance1 (node branch)
+ ;; Rebalance a tree and return t if the height of the tree has shrunk.
+ (let ((br (avl-tree--node-branch node branch))
+ p1 b1 p2 b2 result)
+ (cond
+ ((< (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) 0)
+ t)
+
+ ((= (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) +1)
+ nil)
+
+ (t
+ ;; Rebalance.
+ (setq p1 (avl-tree--node-right br)
+ b1 (avl-tree--node-balance p1))
+ (if (>= b1 0)
+ ;; Single RR rotation.
+ (progn
+ (setf (avl-tree--node-right br) (avl-tree--node-left p1))
+ (setf (avl-tree--node-left p1) br)
+ (if (= 0 b1)
+ (progn
+ (setf (avl-tree--node-balance br) +1)
+ (setf (avl-tree--node-balance p1) -1)
+ (setq result nil))
+ (setf (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance p1) 0)
+ (setq result t))
+ (setf (avl-tree--node-branch node branch) p1)
+ result)
+
+ ;; Double RL rotation.
+ (setq p2 (avl-tree--node-left p1)
+ b2 (avl-tree--node-balance p2))
+ (setf (avl-tree--node-left p1) (avl-tree--node-right p2))
+ (setf (avl-tree--node-right p2) p1)
+ (setf (avl-tree--node-right br) (avl-tree--node-left p2))
+ (setf (avl-tree--node-left p2) br)
+ (setf (avl-tree--node-balance br) (if (> b2 0) -1 0))
+ (setf (avl-tree--node-balance p1) (if (< b2 0) +1 0))
+ (setf (avl-tree--node-branch node branch) p2)
+ (setf (avl-tree--node-balance p2) 0)
+ t)))))
+
+(defun avl-tree--del-balance2 (node branch)
+ (let ((br (avl-tree--node-branch node branch))
+ p1 b1 p2 b2 result)
+ (cond
+ ((> (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) 0)
+ t)
+
+ ((= (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) -1)
+ nil)
+
+ (t
+ ;; Rebalance.
+ (setq p1 (avl-tree--node-left br)
+ b1 (avl-tree--node-balance p1))
+ (if (<= b1 0)
+ ;; Single LL rotation.
+ (progn
+ (setf (avl-tree--node-left br) (avl-tree--node-right p1))
+ (setf (avl-tree--node-right p1) br)
+ (if (= 0 b1)
+ (progn
+ (setf (avl-tree--node-balance br) -1)
+ (setf (avl-tree--node-balance p1) +1)
+ (setq result nil))
+ (setf (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance p1) 0)
+ (setq result t))
+ (setf (avl-tree--node-branch node branch) p1)
+ result)
+
+ ;; Double LR rotation.
+ (setq p2 (avl-tree--node-right p1)
+ b2 (avl-tree--node-balance p2))
+ (setf (avl-tree--node-right p1) (avl-tree--node-left p2))
+ (setf (avl-tree--node-left p2) p1)
+ (setf (avl-tree--node-left br) (avl-tree--node-right p2))
+ (setf (avl-tree--node-right p2) br)
+ (setf (avl-tree--node-balance br) (if (< b2 0) +1 0))
+ (setf (avl-tree--node-balance p1) (if (> b2 0) -1 0))
+ (setf (avl-tree--node-branch node branch) p2)
+ (setf (avl-tree--node-balance p2) 0)
+ t)))))
+
+(defun avl-tree--do-del-internal (node branch q)
+ (let ((br (avl-tree--node-branch node branch)))
+ (if (avl-tree--node-right br)
+ (if (avl-tree--do-del-internal br +1 q)
+ (avl-tree--del-balance2 node branch))
+ (setf (avl-tree--node-data q) (avl-tree--node-data br))
+ (setf (avl-tree--node-branch node branch)
+ (avl-tree--node-left br))
+ t)))
+
+(defun avl-tree--do-delete (cmpfun root branch data)
+ ;; Return t if the height of the tree has shrunk.
+ (let ((br (avl-tree--node-branch root branch)))
+ (cond
+ ((null br)
+ nil)
+
+ ((funcall cmpfun data (avl-tree--node-data br))
+ (if (avl-tree--do-delete cmpfun br 0 data)
+ (avl-tree--del-balance1 root branch)))
+
+ ((funcall cmpfun (avl-tree--node-data br) data)
+ (if (avl-tree--do-delete cmpfun br 1 data)
+ (avl-tree--del-balance2 root branch)))
+
+ (t
+ ;; Found it. Let's delete it.
+ (cond
+ ((null (avl-tree--node-right br))
+ (setf (avl-tree--node-branch root branch) (avl-tree--node-left br))
+ t)
+
+ ((null (avl-tree--node-left br))
+ (setf (avl-tree--node-branch root branch) (avl-tree--node-right br))
+ t)
+
+ (t
+ (if (avl-tree--do-del-internal br 0 br)
+ (avl-tree--del-balance1 root branch))))))))
+
+;; ----------------------------------------------------------------
+;; Entering data
+
+(defun avl-tree--enter-balance1 (node branch)
+ ;; Rebalance a tree and return t if the height of the tree has grown.
+ (let ((br (avl-tree--node-branch node branch))
+ p1 p2 b2 result)
+ (cond
+ ((< (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) 0)
+ nil)
+
+ ((= (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) +1)
+ t)
+
+ (t
+ ;; Tree has grown => Rebalance.
+ (setq p1 (avl-tree--node-right br))
+ (if (> (avl-tree--node-balance p1) 0)
+ ;; Single RR rotation.
+ (progn
+ (setf (avl-tree--node-right br) (avl-tree--node-left p1))
+ (setf (avl-tree--node-left p1) br)
+ (setf (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-branch node branch) p1))
+
+ ;; Double RL rotation.
+ (setq p2 (avl-tree--node-left p1)
+ b2 (avl-tree--node-balance p2))
+ (setf (avl-tree--node-left p1) (avl-tree--node-right p2))
+ (setf (avl-tree--node-right p2) p1)
+ (setf (avl-tree--node-right br) (avl-tree--node-left p2))
+ (setf (avl-tree--node-left p2) br)
+ (setf (avl-tree--node-balance br) (if (> b2 0) -1 0))
+ (setf (avl-tree--node-balance p1) (if (< b2 0) +1 0))
+ (setf (avl-tree--node-branch node branch) p2))
+ (setf (avl-tree--node-balance (avl-tree--node-branch node branch)) 0)
+ nil))))
+
+(defun avl-tree--enter-balance2 (node branch)
+ ;; Return t if the tree has grown.
+ (let ((br (avl-tree--node-branch node branch))
+ p1 p2 b2)
+ (cond
+ ((> (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) 0)
+ nil)
+
+ ((= (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-balance br) -1)
+ t)
+
+ (t
+ ;; Balance was -1 => Rebalance.
+ (setq p1 (avl-tree--node-left br))
+ (if (< (avl-tree--node-balance p1) 0)
+ ;; Single LL rotation.
+ (progn
+ (setf (avl-tree--node-left br) (avl-tree--node-right p1))
+ (setf (avl-tree--node-right p1) br)
+ (setf (avl-tree--node-balance br) 0)
+ (setf (avl-tree--node-branch node branch) p1))
+
+ ;; Double LR rotation.
+ (setq p2 (avl-tree--node-right p1)
+ b2 (avl-tree--node-balance p2))
+ (setf (avl-tree--node-right p1) (avl-tree--node-left p2))
+ (setf (avl-tree--node-left p2) p1)
+ (setf (avl-tree--node-left br) (avl-tree--node-right p2))
+ (setf (avl-tree--node-right p2) br)
+ (setf (avl-tree--node-balance br) (if (< b2 0) +1 0))
+ (setf (avl-tree--node-balance p1) (if (> b2 0) -1 0))
+ (setf (avl-tree--node-branch node branch) p2))
+ (setf (avl-tree--node-balance (avl-tree--node-branch node branch)) 0)
+ nil))))
+
+(defun avl-tree--do-enter (cmpfun root branch data)
+ ;; Return t if height of tree ROOT has grown. INTERNAL USE ONLY.
+ (let ((br (avl-tree--node-branch root branch)))
+ (cond
+ ((null br)
+ ;; Data not in tree, insert it.
+ (setf (avl-tree--node-branch root branch)
+ (avl-tree--node-create nil nil data 0))
+ t)
+
+ ((funcall cmpfun data (avl-tree--node-data br))
+ (and (avl-tree--do-enter cmpfun br 0 data)
+ (avl-tree--enter-balance2 root branch)))
+
+ ((funcall cmpfun (avl-tree--node-data br) data)
+ (and (avl-tree--do-enter cmpfun br 1 data)
+ (avl-tree--enter-balance1 root branch)))
+
+ (t
+ (setf (avl-tree--node-data br) data)
+ nil))))
+
+;; ----------------------------------------------------------------
+
+(defun avl-tree--mapc (map-function root)
+ ;; Apply MAP-FUNCTION to all nodes in the tree starting with ROOT.
+ ;; The function is applied in-order.
+ ;;
+ ;; Note: MAP-FUNCTION is applied to the node and not to the data itself.
+ ;; INTERNAL USE ONLY.
+ (let ((node root)
+ (stack nil)
+ (go-left t))
+ (push nil stack)
+ (while node
+ (if (and go-left
+ (avl-tree--node-left node))
+ ;; Do the left subtree first.
+ (progn
+ (push node stack)
+ (setq node (avl-tree--node-left node)))
+ ;; Apply the function...
+ (funcall map-function node)
+ ;; and do the right subtree.
+ (setq node (if (setq go-left (avl-tree--node-right node))
+ (avl-tree--node-right node)
+ (pop stack)))))))
+
+(defun avl-tree--do-copy (root)
+ ;; Copy the avl tree with ROOT as root.
+ ;; Highly recursive. INTERNAL USE ONLY.
+ (if (null root)
+ nil
+ (avl-tree--node-create
+ (avl-tree--do-copy (avl-tree--node-left root))
+ (avl-tree--do-copy (avl-tree--node-right root))
+ (avl-tree--node-data root)
+ (avl-tree--node-balance root))))
+
+
+;; ================================================================
+;;; The public functions which operate on AVL trees.
+
+(defalias 'avl-tree-compare-function 'avl-tree--cmpfun
+ "Return the comparison function for the avl tree TREE.
+
+\(fn TREE)")
+
+(defun avl-tree-empty (tree)
+ "Return t if avl tree TREE is emtpy, otherwise return nil."
+ (null (avl-tree--root tree)))
+
+(defun avl-tree-enter (tree data)
+ "In the avl tree TREE insert DATA.
+Return DATA."
+ (avl-tree--do-enter (avl-tree--cmpfun tree)
+ (avl-tree--dummyroot tree)
+ 0
+ data)
+ data)
+
+(defun avl-tree-delete (tree data)
+ "From the avl tree TREE, delete DATA.
+Return the element in TREE which matched DATA,
+nil if no element matched."
+ (avl-tree--do-delete (avl-tree--cmpfun tree)
+ (avl-tree--dummyroot tree)
+ 0
+ data))
+
+(defun avl-tree-member (tree data)
+ "Return the element in the avl tree TREE which matches DATA.
+Matching uses the compare function previously specified in
+`avl-tree-create' when TREE was created.
+
+If there is no such element in the tree, the value is nil."
+ (let ((node (avl-tree--root tree))
+ (compare-function (avl-tree--cmpfun tree))
+ found)
+ (while (and node
+ (not found))
+ (cond
+ ((funcall compare-function data (avl-tree--node-data node))
+ (setq node (avl-tree--node-left node)))
+ ((funcall compare-function (avl-tree--node-data node) data)
+ (setq node (avl-tree--node-right node)))
+ (t
+ (setq found t))))
+ (if node
+ (avl-tree--node-data node)
+ nil)))
+
+(defun avl-tree-map (__map-function__ tree)
+ "Apply __MAP-FUNCTION__ to all elements in the avl tree TREE."
+ (avl-tree--mapc
+ (lambda (node)
+ (setf (avl-tree--node-data node)
+ (funcall __map-function__ (avl-tree--node-data node))))
+ (avl-tree--root tree)))
+
+(defun avl-tree-first (tree)
+ "Return the first element in TREE, or nil if TREE is empty."
+ (let ((node (avl-tree--root tree)))
+ (when node
+ (while (avl-tree--node-left node)
+ (setq node (avl-tree--node-left node)))
+ (avl-tree--node-data node))))
+
+(defun avl-tree-last (tree)
+ "Return the last element in TREE, or nil if TREE is empty."
+ (let ((node (avl-tree--root tree)))
+ (when node
+ (while (avl-tree--node-right node)
+ (setq node (avl-tree--node-right node)))
+ (avl-tree--node-data node))))
+
+(defun avl-tree-copy (tree)
+ "Return a copy of the avl tree TREE."
+ (let ((new-tree (avl-tree-create (avl-tree--cmpfun tree))))
+ (setf (avl-tree--root new-tree) (avl-tree--do-copy (avl-tree--root tree)))
+ new-tree))
+
+(defun avl-tree-flatten (tree)
+ "Return a sorted list containing all elements of TREE."
+ (nreverse
+ (let ((treelist nil))
+ (avl-tree--mapc
+ (lambda (node) (push (avl-tree--node-data node) treelist))
+ (avl-tree--root tree))
+ treelist)))
+
+(defun avl-tree-size (tree)
+ "Return the number of elements in TREE."
+ (let ((treesize 0))
+ (avl-tree--mapc
+ (lambda (data) (setq treesize (1+ treesize)))
+ (avl-tree--root tree))
+ treesize))
+
+(defun avl-tree-clear (tree)
+ "Clear the avl tree TREE."
+ (setf (avl-tree--root tree) nil))
+
+(provide 'avl-tree)
+
+;; arch-tag: 47e26701-43c9-4222-bd79-739eac6357a9
+;;; avl-tree.el ends here
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 6f653c8fc6..fdeab460c7 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -31,7 +31,7 @@
;; "No matter how hard you try, you can't make a racehorse out of a pig.
;; You can, however, make a faster pig."
;;
-;; Or, to put it another way, the emacs byte compiler is a VW Bug. This code
+;; Or, to put it another way, the Emacs byte compiler is a VW Bug. This code
;; makes it be a VW Bug with fuel injection and a turbocharger... You're
;; still not going to make it go faster than 70 mph, but it might be easier
;; to get it there.
@@ -1014,12 +1014,23 @@
form))
(defun byte-optimize-if (form)
+ ;; (if (progn <insts> <test>) <rest>) ==> (progn <insts> (if <test> <rest>))
;; (if <true-constant> <then> <else...>) ==> <then>
;; (if <false-constant> <then> <else...>) ==> (progn <else...>)
;; (if <test> nil <else...>) ==> (if (not <test>) (progn <else...>))
;; (if <test> <then> nil) ==> (if <test> <then>)
(let ((clause (nth 1 form)))
- (cond ((byte-compile-trueconstp clause)
+ (cond ((and (eq (car-safe clause) 'progn)
+ ;; `clause' is a proper list.
+ (null (cdr (last clause))))
+ (if (null (cddr clause))
+ ;; A trivial `progn'.
+ (byte-optimize-if `(if ,(cadr clause) ,@(nthcdr 2 form)))
+ (nconc (butlast clause)
+ (list
+ (byte-optimize-if
+ `(if ,(car (last clause)) ,@(nthcdr 2 form)))))))
+ ((byte-compile-trueconstp clause)
(nth 2 form))
((null clause)
(if (nthcdr 4 form)
@@ -1326,7 +1337,7 @@
;; This list contains numbers, which are pc values,
;; before each instruction.
(defun byte-decompile-bytecode (bytes constvec)
- "Turns BYTECODE into lapcode, referring to CONSTVEC."
+ "Turn BYTECODE into lapcode, referring to CONSTVEC."
(let ((byte-compile-constants nil)
(byte-compile-variables nil)
(byte-compile-tag-number 0))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 6cc61426f3..5a5c639f0a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -98,9 +98,12 @@
;; `obsolete' (obsolete variables and functions)
;; `noruntime' (calls to functions only defined
;; within `eval-when-compile')
-;; `cl-warnings' (calls to CL functions)
+;; `cl-functions' (calls to CL functions)
;; `interactive-only' (calls to commands that are
;; not good to call from Lisp)
+;; `make-local' (dubious calls to
+;; `make-variable-buffer-local')
+;; `mapcar' (mapcar called for effect)
;; byte-compile-compatibility Whether the compiler should
;; generate .elc files which can be loaded into
;; generic emacs 18.
@@ -338,7 +341,8 @@ If it is 'byte, then only byte-level optimizations will be logged."
(defconst byte-compile-warning-types
'(redefine callargs free-vars unresolved
- obsolete noruntime cl-functions interactive-only)
+ obsolete noruntime cl-functions interactive-only
+ make-local mapcar)
"The list of warning types used when `byte-compile-warnings' is t.")
(defcustom byte-compile-warnings t
"*List of warnings that the byte-compiler should issue (t for all).
@@ -356,14 +360,17 @@ Elements of the list may be:
cl-functions calls to runtime functions from the CL package (as
distinguished from macros and aliases).
interactive-only
- commands that normally shouldn't be called from Lisp code."
+ commands that normally shouldn't be called from Lisp code.
+ make-local calls to make-variable-buffer-local that may be incorrect.
+ mapcar mapcar called for effect."
:group 'bytecomp
:type `(choice (const :tag "All" t)
(set :menu-tag "Some"
(const free-vars) (const unresolved)
(const callargs) (const redefine)
(const obsolete) (const noruntime)
- (const cl-functions) (const interactive-only))))
+ (const cl-functions) (const interactive-only)
+ (const make-local) (const mapcar))))
(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
;;;###autoload
(defun byte-compile-warnings-safe-p (x)
@@ -374,14 +381,15 @@ Elements of the list may be:
(when (memq e '(free-vars unresolved
callargs redefine
obsolete noruntime
- cl-functions interactive-only))
+ cl-functions interactive-only
+ make-local mapcar))
e))
x)
x))))
(defvar byte-compile-interactive-only-functions
'(beginning-of-buffer end-of-buffer replace-string replace-regexp
- insert-file insert-buffer insert-file-literally)
+ insert-file insert-buffer insert-file-literally previous-line next-line)
"List of commands that are not meant to be called from Lisp.")
(defvar byte-compile-not-obsolete-var nil
@@ -850,13 +858,11 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(when (and (consp s) (eq t (car s)))
(push (cdr s) old-autoloads)))))))
(when (memq 'cl-functions byte-compile-warnings)
- (let ((hist-new load-history)
- (hist-nil-new current-load-list))
+ (let ((hist-new load-history))
;; Go through load-history, look for newly loaded files
;; and mark all the functions defined therein.
(while (and hist-new (not (eq hist-new hist-orig)))
- (let ((xs (pop hist-new))
- old-autoloads)
+ (let ((xs (pop hist-new)))
;; Make sure the file was not already loaded before.
(when (and (equal (car xs) "cl") (not (assoc (car xs) hist-orig)))
(byte-compile-find-cl-functions)))))))))
@@ -973,7 +979,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(pos (if (and byte-compile-current-file
(integerp byte-compile-read-position))
(with-current-buffer byte-compile-current-buffer
- (format "%d:%d:"
+ (format "%d:%d:"
(save-excursion
(goto-char byte-compile-last-position)
(1+ (count-lines (point-min) (point-at-bol))))
@@ -1035,8 +1041,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(setq byte-compile-last-logged-file byte-compile-current-file
byte-compile-last-warned-form nil)
;; Do this after setting default-directory.
- (unless (eq major-mode 'compilation-mode)
- (compilation-mode))
+ (unless (derived-mode-p 'compilation-mode) (compilation-mode))
(compilation-forget-errors)
pt))))
@@ -1261,7 +1266,7 @@ extra args."
(get (car form) 'byte-compile-format-like))
(let ((nfields (with-temp-buffer
(insert (nth 1 form))
- (goto-char 1)
+ (goto-char (point-min))
(let ((n 0))
(while (re-search-forward "%." nil t)
(unless (eq ?% (char-after (1+ (match-beginning 0))))
@@ -1279,19 +1284,19 @@ extra args."
;; Warn if a custom definition fails to specify :group.
(defun byte-compile-nogroup-warn (form)
(let ((keyword-args (cdr (cdr (cdr (cdr form)))))
- (name (cadr form)))
+ (name (cadr form)))
(or (not (eq (car-safe name) 'quote))
- (and (eq (car form) 'custom-declare-group)
- (equal name ''emacs))
- (plist-get keyword-args :group)
- (not (and (consp name) (eq (car name) 'quote)))
- (byte-compile-warn
- "%s for `%s' fails to specify containing group"
- (cdr (assq (car form)
- '((custom-declare-group . defgroup)
- (custom-declare-face . defface)
- (custom-declare-variable . defcustom))))
- (cadr name)))))
+ (and (eq (car form) 'custom-declare-group)
+ (equal name ''emacs))
+ (plist-get keyword-args :group)
+ (not (and (consp name) (eq (car name) 'quote)))
+ (byte-compile-warn
+ "%s for `%s' fails to specify containing group"
+ (cdr (assq (car form)
+ '((custom-declare-group . defgroup)
+ (custom-declare-face . defface)
+ (custom-declare-variable . defcustom))))
+ (cadr name)))))
;; Warn if the function or macro is being redefined with a different
;; number of arguments.
@@ -1344,7 +1349,8 @@ extra args."
(unless byte-compile-cl-functions
(dolist (elt load-history)
(when (and (stringp (car elt))
- (string-match "^cl\\>" (car elt)))
+ (string-match
+ "^cl\\>" (file-name-nondirectory (car elt))))
(setq byte-compile-cl-functions
(append byte-compile-cl-functions
(cdr elt)))))
@@ -1656,7 +1662,7 @@ The value is non-nil if there were no errors, nil if errors."
byte-compile-dest-file)
(setq target-file (byte-compile-dest-file filename))
(setq byte-compile-dest-file target-file)
- (with-current-buffer
+ (with-current-buffer
(setq input-buffer (get-buffer-create " *Compiler Input*"))
(erase-buffer)
(setq buffer-file-coding-system nil)
@@ -1843,7 +1849,7 @@ With argument, insert value in current buffer after the form."
(displaying-byte-compile-warnings
(and filename (byte-compile-insert-header filename inbuffer outbuffer))
(with-current-buffer inbuffer
- (goto-char 1)
+ (goto-char (point-min))
;; Should we always do this? When calling multiple files, it
;; would be useful to delay this warning until all have been
;; compiled. A: Yes! b-c-u-f might contain dross from a
@@ -1918,7 +1924,7 @@ and will be removed soon. See (elisp)Backquote in the manual."))
(let ((dynamic-docstrings byte-compile-dynamic-docstrings)
(dynamic byte-compile-dynamic))
(set-buffer outbuffer)
- (goto-char 1)
+ (goto-char (point-min))
;; The magic number of .elc files is ";ELC", or 0x3B454C43. After
;; that is the file-format version number (18, 19 or 20) as a
;; byte, followed by some nulls. The primary motivation for doing
@@ -2037,86 +2043,83 @@ list that represents a doc string reference.
;; We need to examine byte-compile-dynamic-docstrings
;; in the input buffer (now current), not in the output buffer.
(let ((dynamic-docstrings byte-compile-dynamic-docstrings))
- ;; FIXME: What's up with those set-buffers&prog1 thingy? --Stef
- (set-buffer
- (prog1 (current-buffer)
- (set-buffer outbuffer)
- (let (position)
-
- ;; Insert the doc string, and make it a comment with #@LENGTH.
- (and (>= (nth 1 info) 0)
- dynamic-docstrings
- (not byte-compile-compatibility)
- (progn
- ;; Make the doc string start at beginning of line
- ;; for make-docfile's sake.
- (insert "\n")
- (setq position
- (byte-compile-output-as-comment
- (nth (nth 1 info) form) nil))
- (setq position (- (position-bytes position) (point-min) -1))
- ;; If the doc string starts with * (a user variable),
- ;; negate POSITION.
- (if (and (stringp (nth (nth 1 info) form))
- (> (length (nth (nth 1 info) form)) 0)
- (eq (aref (nth (nth 1 info) form) 0) ?*))
- (setq position (- position)))))
-
- (if preface
- (progn
- (insert preface)
- (prin1 name outbuffer)))
- (insert (car info))
- (let ((print-escape-newlines t)
- (print-quoted t)
- ;; For compatibility with code before print-circle,
- ;; use a cons cell to say that we want
- ;; print-gensym-alist not to be cleared
- ;; between calls to print functions.
- (print-gensym '(t))
- (print-circle ; handle circular data structures
- (not byte-compile-disable-print-circle))
- print-gensym-alist ; was used before print-circle existed.
- (print-continuous-numbering t)
- print-number-table
- (index 0))
- (prin1 (car form) outbuffer)
- (while (setq form (cdr form))
- (setq index (1+ index))
- (insert " ")
- (cond ((and (numberp specindex) (= index specindex)
- ;; Don't handle the definition dynamically
- ;; if it refers (or might refer)
- ;; to objects already output
- ;; (for instance, gensyms in the arg list).
- (let (non-nil)
- (dotimes (i (length print-number-table))
- (if (aref print-number-table i)
- (setq non-nil t)))
- (not non-nil)))
- ;; Output the byte code and constants specially
- ;; for lazy dynamic loading.
- (let ((position
- (byte-compile-output-as-comment
- (cons (car form) (nth 1 form))
- t)))
- (setq position (- (position-bytes position) (point-min) -1))
- (princ (format "(#$ . %d) nil" position) outbuffer)
- (setq form (cdr form))
- (setq index (1+ index))))
- ((= index (nth 1 info))
- (if position
- (princ (format (if quoted "'(#$ . %d)" "(#$ . %d)")
- position)
- outbuffer)
- (let ((print-escape-newlines nil))
- (goto-char (prog1 (1+ (point))
- (prin1 (car form) outbuffer)))
- (insert "\\\n")
- (goto-char (point-max)))))
- (t
- (prin1 (car form) outbuffer)))))
- (insert (nth 2 info))))))
+ (with-current-buffer outbuffer
+ (let (position)
+
+ ;; Insert the doc string, and make it a comment with #@LENGTH.
+ (and (>= (nth 1 info) 0)
+ dynamic-docstrings
+ (not byte-compile-compatibility)
+ (progn
+ ;; Make the doc string start at beginning of line
+ ;; for make-docfile's sake.
+ (insert "\n")
+ (setq position
+ (byte-compile-output-as-comment
+ (nth (nth 1 info) form) nil))
+ (setq position (- (position-bytes position) (point-min) -1))
+ ;; If the doc string starts with * (a user variable),
+ ;; negate POSITION.
+ (if (and (stringp (nth (nth 1 info) form))
+ (> (length (nth (nth 1 info) form)) 0)
+ (eq (aref (nth (nth 1 info) form) 0) ?*))
+ (setq position (- position)))))
+
+ (if preface
+ (progn
+ (insert preface)
+ (prin1 name outbuffer)))
+ (insert (car info))
+ (let ((print-escape-newlines t)
+ (print-quoted t)
+ ;; For compatibility with code before print-circle,
+ ;; use a cons cell to say that we want
+ ;; print-gensym-alist not to be cleared
+ ;; between calls to print functions.
+ (print-gensym '(t))
+ (print-circle ; handle circular data structures
+ (not byte-compile-disable-print-circle))
+ print-gensym-alist ; was used before print-circle existed.
+ (print-continuous-numbering t)
+ print-number-table
+ (index 0))
+ (prin1 (car form) outbuffer)
+ (while (setq form (cdr form))
+ (setq index (1+ index))
+ (insert " ")
+ (cond ((and (numberp specindex) (= index specindex)
+ ;; Don't handle the definition dynamically
+ ;; if it refers (or might refer)
+ ;; to objects already output
+ ;; (for instance, gensyms in the arg list).
+ (let (non-nil)
+ (dotimes (i (length print-number-table))
+ (if (aref print-number-table i)
+ (setq non-nil t)))
+ (not non-nil)))
+ ;; Output the byte code and constants specially
+ ;; for lazy dynamic loading.
+ (let ((position
+ (byte-compile-output-as-comment
+ (cons (car form) (nth 1 form))
+ t)))
+ (setq position (- (position-bytes position) (point-min) -1))
+ (princ (format "(#$ . %d) nil" position) outbuffer)
+ (setq form (cdr form))
+ (setq index (1+ index))))
+ ((= index (nth 1 info))
+ (if position
+ (princ (format (if quoted "'(#$ . %d)" "(#$ . %d)")
+ position)
+ outbuffer)
+ (let ((print-escape-newlines nil))
+ (goto-char (prog1 (1+ (point))
+ (prin1 (car form) outbuffer)))
+ (insert "\\\n")
+ (goto-char (point-max)))))
+ (t
+ (prin1 (car form) outbuffer)))))
+ (insert (nth 2 info)))))
nil)
(defun byte-compile-keep-pending (form &optional handler)
@@ -2240,8 +2243,7 @@ list that represents a doc string reference.
(put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
(defun byte-compile-file-form-require (form)
- (let ((old-load-list current-load-list)
- (args (mapcar 'eval (cdr form))))
+ (let ((args (mapcar 'eval (cdr form))))
(apply 'require args)
;; Detect (require 'cl) in a way that works even if cl is already loaded.
(if (member (car args) '("cl" cl))
@@ -2403,39 +2405,37 @@ list that represents a doc string reference.
;; If QUOTED is non-nil, print with quoting; otherwise, print without quoting.
(defun byte-compile-output-as-comment (exp quoted)
(let ((position (point)))
- (set-buffer
- (prog1 (current-buffer)
- (set-buffer outbuffer)
-
- ;; Insert EXP, and make it a comment with #@LENGTH.
- (insert " ")
- (if quoted
- (prin1 exp outbuffer)
- (princ exp outbuffer))
- (goto-char position)
- ;; Quote certain special characters as needed.
- ;; get_doc_string in doc.c does the unquoting.
- (while (search-forward "\^A" nil t)
- (replace-match "\^A\^A" t t))
- (goto-char position)
- (while (search-forward "\000" nil t)
- (replace-match "\^A0" t t))
- (goto-char position)
- (while (search-forward "\037" nil t)
- (replace-match "\^A_" t t))
- (goto-char (point-max))
- (insert "\037")
- (goto-char position)
- (insert "#@" (format "%d" (- (position-bytes (point-max))
- (position-bytes position))))
-
- ;; Save the file position of the object.
- ;; Note we should add 1 to skip the space
- ;; that we inserted before the actual doc string,
- ;; and subtract 1 to convert from an 1-origin Emacs position
- ;; to a file position; they cancel.
- (setq position (point))
- (goto-char (point-max))))
+ (with-current-buffer outbuffer
+
+ ;; Insert EXP, and make it a comment with #@LENGTH.
+ (insert " ")
+ (if quoted
+ (prin1 exp outbuffer)
+ (princ exp outbuffer))
+ (goto-char position)
+ ;; Quote certain special characters as needed.
+ ;; get_doc_string in doc.c does the unquoting.
+ (while (search-forward "\^A" nil t)
+ (replace-match "\^A\^A" t t))
+ (goto-char position)
+ (while (search-forward "\000" nil t)
+ (replace-match "\^A0" t t))
+ (goto-char position)
+ (while (search-forward "\037" nil t)
+ (replace-match "\^A_" t t))
+ (goto-char (point-max))
+ (insert "\037")
+ (goto-char position)
+ (insert "#@" (format "%d" (- (position-bytes (point-max))
+ (position-bytes position))))
+
+ ;; Save the file position of the object.
+ ;; Note we should add 1 to skip the space
+ ;; that we inserted before the actual doc string,
+ ;; and subtract 1 to convert from an 1-origin Emacs position
+ ;; to a file position; they cancel.
+ (setq position (point))
+ (goto-char (point-max)))
position))
@@ -2835,6 +2835,11 @@ That command is designed for interactive use only" fn))
(defun byte-compile-normal-call (form)
(if byte-compile-generate-call-tree
(byte-compile-annotate-call-tree form))
+ (when (and for-effect (eq (car form) 'mapcar)
+ (memq 'mapcar byte-compile-warnings))
+ (byte-compile-set-symbol-position 'mapcar)
+ (byte-compile-warn
+ "`mapcar' called for effect; use `mapc' or `dolist' instead"))
(byte-compile-push-constant (car form))
(mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
(byte-compile-out 'byte-call (length (cdr form))))
@@ -3892,7 +3897,8 @@ that suppresses all warnings during execution of BODY."
;; Warn about misuses of make-variable-buffer-local.
(byte-defop-compiler-1 make-variable-buffer-local byte-compile-make-variable-buffer-local)
(defun byte-compile-make-variable-buffer-local (form)
- (if (eq (car-safe (car-safe (cdr-safe form))) 'quote)
+ (if (and (eq (car-safe (car-safe (cdr-safe form))) 'quote)
+ (memq 'make-local byte-compile-warnings))
(byte-compile-warn
"`make-variable-buffer-local' should be called at toplevel"))
(byte-compile-normal-call form))
@@ -4237,18 +4243,18 @@ and corresponding effects."
(assq 'byte-code (symbol-function 'byte-compile-form))
(let ((byte-optimize nil) ; do it fast
(byte-compile-warnings nil))
- (mapcar (lambda (x)
- (or noninteractive (message "compiling %s..." x))
- (byte-compile x)
- (or noninteractive (message "compiling %s...done" x)))
- '(byte-compile-normal-call
- byte-compile-form
- byte-compile-body
- ;; Inserted some more than necessary, to speed it up.
- byte-compile-top-level
- byte-compile-out-toplevel
- byte-compile-constant
- byte-compile-variable-ref))))
+ (mapc (lambda (x)
+ (or noninteractive (message "compiling %s..." x))
+ (byte-compile x)
+ (or noninteractive (message "compiling %s...done" x)))
+ '(byte-compile-normal-call
+ byte-compile-form
+ byte-compile-body
+ ;; Inserted some more than necessary, to speed it up.
+ byte-compile-top-level
+ byte-compile-out-toplevel
+ byte-compile-constant
+ byte-compile-variable-ref))))
nil)
(run-hooks 'bytecomp-load-hook)
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index e1835d75fc..edbf382f39 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -199,6 +199,12 @@
:group 'lisp
:version "20.3")
+(defcustom checkdoc-minor-mode-string " CDoc"
+ "*String to display in mode line when Checkdoc mode is enabled; nil for none."
+ :type '(choice string (const :tag "None" nil))
+ :group 'checkdoc
+ :version "23.1")
+
(defcustom checkdoc-autofix-flag 'semiautomatic
"Non-nil means attempt auto-fixing of doc strings.
If this value is the symbol `query', then the user is queried before
@@ -227,7 +233,7 @@ and that it's good but not required practice to make non user visible items
have doc strings."
:group 'checkdoc
:type 'boolean)
-(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp)
+;;;###autoload(put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp)
(defcustom checkdoc-force-history-flag t
"Non-nil means that files should have a History section or ChangeLog file.
@@ -243,7 +249,7 @@ should be used when the first part could stand alone as a sentence, but
it indicates that a modifying clause follows."
:group 'checkdoc
:type 'boolean)
-(put 'checkdoc-permit-comma-termination-flag 'safe-local-variable 'booleanp)
+;;;###autoload(put 'checkdoc-permit-comma-termination-flag 'safe-local-variable 'booleanp)
(defcustom checkdoc-spellcheck-documentation-flag nil
"Non-nil means run Ispell on text based on value.
@@ -1251,7 +1257,7 @@ bound to \\<checkdoc-minor-mode-map>\\[checkdoc-eval-defun] and `checkdoc-eval-c
checking of documentation strings.
\\{checkdoc-minor-mode-map}"
- nil " CDoc" nil
+ nil checkdoc-minor-mode-string nil
:group 'checkdoc)
;;; Subst utils
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 3036bb7ea7..375a07f9f7 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -43,6 +43,7 @@
;;; Type coercion.
+;;;###autoload
(defun coerce (x type)
"Coerce OBJECT to type TYPE.
TYPE is a Common Lisp type specifier.
@@ -60,6 +61,7 @@ TYPE is a Common Lisp type specifier.
;;; Predicates.
+;;;###autoload
(defun equalp (x y)
"Return t if two Lisp objects have similar structures and contents.
This is like `equal', except that it accepts numerically equal
@@ -87,6 +89,7 @@ strings case-insensitively."
;;; Control structures.
+;;;###autoload
(defun cl-mapcar-many (cl-func cl-seqs)
(if (cdr (cdr cl-seqs))
(let* ((cl-res nil)
@@ -119,6 +122,7 @@ strings case-insensitively."
cl-res)))
(nreverse cl-res))))
+;;;###autoload
(defun map (cl-type cl-func cl-seq &rest cl-rest)
"Map a FUNCTION across one or more SEQUENCEs, returning a sequence.
TYPE is the sequence type to return.
@@ -126,6 +130,7 @@ TYPE is the sequence type to return.
(let ((cl-res (apply 'mapcar* cl-func cl-seq cl-rest)))
(and cl-type (coerce cl-res cl-type))))
+;;;###autoload
(defun maplist (cl-func cl-list &rest cl-rest)
"Map FUNCTION to each sublist of LIST or LISTs.
Like `mapcar', except applies to lists and their cdr's rather than to
@@ -154,6 +159,7 @@ the elements themselves.
cl-seq)
(mapc cl-func cl-seq)))
+;;;###autoload
(defun mapl (cl-func cl-list &rest cl-rest)
"Like `maplist', but does not accumulate values returned by the function.
\n(fn FUNCTION LIST...)"
@@ -163,16 +169,19 @@ the elements themselves.
(while cl-p (funcall cl-func cl-p) (setq cl-p (cdr cl-p)))))
cl-list)
+;;;###autoload
(defun mapcan (cl-func cl-seq &rest cl-rest)
"Like `mapcar', but nconc's together the values returned by the function.
\n(fn FUNCTION SEQUENCE...)"
(apply 'nconc (apply 'mapcar* cl-func cl-seq cl-rest)))
+;;;###autoload
(defun mapcon (cl-func cl-list &rest cl-rest)
"Like `maplist', but nconc's together the values returned by the function.
\n(fn FUNCTION LIST...)"
(apply 'nconc (apply 'maplist cl-func cl-list cl-rest)))
+;;;###autoload
(defun some (cl-pred cl-seq &rest cl-rest)
"Return true if PREDICATE is true of any element of SEQ or SEQs.
If so, return the true (non-nil) value returned by PREDICATE.
@@ -188,6 +197,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(while (and cl-seq (not (setq cl-x (funcall cl-pred (pop cl-seq))))))
cl-x)))
+;;;###autoload
(defun every (cl-pred cl-seq &rest cl-rest)
"Return true if PREDICATE is true of every element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
@@ -201,19 +211,23 @@ If so, return the true (non-nil) value returned by PREDICATE.
(setq cl-seq (cdr cl-seq)))
(null cl-seq)))
+;;;###autoload
(defun notany (cl-pred cl-seq &rest cl-rest)
"Return true if PREDICATE is false of every element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
(not (apply 'some cl-pred cl-seq cl-rest)))
+;;;###autoload
(defun notevery (cl-pred cl-seq &rest cl-rest)
"Return true if PREDICATE is false of some element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
(not (apply 'every cl-pred cl-seq cl-rest)))
;;; Support for `loop'.
+;;;###autoload
(defalias 'cl-map-keymap 'map-keymap)
+;;;###autoload
(defun cl-map-keymap-recursively (cl-func-rec cl-map &optional cl-base)
(or cl-base
(setq cl-base (copy-sequence [0])))
@@ -228,6 +242,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(funcall cl-func-rec cl-base cl-bind))))
cl-map))
+;;;###autoload
(defun cl-map-intervals (cl-func &optional cl-what cl-prop cl-start cl-end)
(or cl-what (setq cl-what (current-buffer)))
(if (bufferp cl-what)
@@ -255,6 +270,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(funcall cl-func cl-start (min cl-next cl-end))
(setq cl-start cl-next)))))
+;;;###autoload
(defun cl-map-overlays (cl-func &optional cl-buffer cl-start cl-end cl-arg)
(or cl-buffer (setq cl-buffer (current-buffer)))
(if (fboundp 'overlay-lists)
@@ -296,6 +312,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(set-marker cl-mark nil) (if cl-mark2 (set-marker cl-mark2 nil)))))
;;; Support for `setf'.
+;;;###autoload
(defun cl-set-frame-visible-p (frame val)
(cond ((null val) (make-frame-invisible frame))
((eq val 'icon) (iconify-frame frame))
@@ -304,6 +321,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
;;; Support for `progv'.
(defvar cl-progv-save)
+;;;###autoload
(defun cl-progv-before (syms values)
(while syms
(push (if (boundp (car syms))
@@ -323,6 +341,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
;;; Numbers.
+;;;###autoload
(defun gcd (&rest args)
"Return the greatest common divisor of the arguments."
(let ((a (abs (or (pop args) 0))))
@@ -331,6 +350,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(while (> b 0) (setq b (% a (setq a b))))))
a))
+;;;###autoload
(defun lcm (&rest args)
"Return the least common multiple of the arguments."
(if (memq 0 args)
@@ -341,6 +361,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
(setq a (* (/ a (gcd a b)) b))))
a)))
+;;;###autoload
(defun isqrt (x)
"Return the integer square root of the argument."
(if (and (integerp x) (> x 0))
@@ -352,12 +373,14 @@ If so, return the true (non-nil) value returned by PREDICATE.
g)
(if (eq x 0) 0 (signal 'arith-error nil))))
+;;;###autoload
(defun floor* (x &optional y)
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."
(let ((q (floor x y)))
(list q (- x (if y (* y q) q)))))
+;;;###autoload
(defun ceiling* (x &optional y)
"Return a list of the ceiling of X and the fractional part of X.
With two arguments, return ceiling and remainder of their quotient."
@@ -365,12 +388,14 @@ With two arguments, return ceiling and remainder of their quotient."
(if (= (car (cdr res)) 0) res
(list (1+ (car res)) (- (car (cdr res)) (or y 1))))))
+;;;###autoload
(defun truncate* (x &optional y)
"Return a list of the integer part of X and the fractional part of X.
With two arguments, return truncation and remainder of their quotient."
(if (eq (>= x 0) (or (null y) (>= y 0)))
(floor* x y) (ceiling* x y)))
+;;;###autoload
(defun round* (x &optional y)
"Return a list of X rounded to the nearest integer and the remainder.
With two arguments, return rounding and remainder of their quotient."
@@ -389,14 +414,17 @@ With two arguments, return rounding and remainder of their quotient."
(let ((q (round x)))
(list q (- x q))))))
+;;;###autoload
(defun mod* (x y)
"The remainder of X divided by Y, with the same sign as Y."
(nth 1 (floor* x y)))
+;;;###autoload
(defun rem* (x y)
"The remainder of X divided by Y, with the same sign as X."
(nth 1 (truncate* x y)))
+;;;###autoload
(defun signum (x)
"Return 1 if X is positive, -1 if negative, 0 if zero."
(cond ((> x 0) 1) ((< x 0) -1) (t 0)))
@@ -405,6 +433,7 @@ With two arguments, return rounding and remainder of their quotient."
;; Random numbers.
(defvar *random-state*)
+;;;###autoload
(defun random* (lim &optional state)
"Return a random nonnegative number less than LIM, an integer or float.
Optional second arg STATE is a random-state object."
@@ -412,7 +441,7 @@ Optional second arg STATE is a random-state object."
;; Inspired by "ran3" from Numerical Recipes. Additive congruential method.
(let ((vec (aref state 3)))
(if (integerp vec)
- (let ((i 0) (j (- 1357335 (% (abs vec) 1357333))) (k 1) ii)
+ (let ((i 0) (j (- 1357335 (% (abs vec) 1357333))) (k 1))
(aset state 3 (setq vec (make-vector 55 nil)))
(aset vec 0 j)
(while (> (setq i (% (+ i 21) 55)) 0)
@@ -429,6 +458,7 @@ Optional second arg STATE is a random-state object."
(if (< (setq n (logand n mask)) lim) n (random* lim state))))
(* (/ n '8388608e0) lim)))))
+;;;###autoload
(defun make-random-state (&optional state)
"Return a copy of random-state STATE, or of `*random-state*' if omitted.
If STATE is t, return a new state object seeded from the time of day."
@@ -437,6 +467,7 @@ If STATE is t, return a new state object seeded from the time of day."
((integerp state) (vector 'cl-random-state-tag -1 30 state))
(t (make-random-state (cl-random-time)))))
+;;;###autoload
(defun random-state-p (object)
"Return t if OBJECT is a random-state object."
(and (vectorp object) (= (length object) 4)
@@ -460,6 +491,7 @@ If STATE is t, return a new state object seeded from the time of day."
(defvar float-epsilon)
(defvar float-negative-epsilon)
+;;;###autoload
(defun cl-float-limits ()
(or most-positive-float (not (numberp '2e1))
(let ((x '2e0) y z)
@@ -497,6 +529,7 @@ If STATE is t, return a new state object seeded from the time of day."
;;; Sequence functions.
+;;;###autoload
(defun subseq (seq start &optional end)
"Return the subsequence of SEQ from START to END.
If END is omitted, it defaults to the length of the sequence.
@@ -522,6 +555,7 @@ If START or END is negative, it counts from the end."
(setq i (1+ i) start (1+ start)))
res))))))
+;;;###autoload
(defun concatenate (type &rest seqs)
"Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
\n(fn TYPE SEQUENCE...)"
@@ -533,14 +567,17 @@ If START or END is negative, it counts from the end."
;;; List functions.
+;;;###autoload
(defun revappend (x y)
"Equivalent to (append (reverse X) Y)."
(nconc (reverse x) y))
+;;;###autoload
(defun nreconc (x y)
"Equivalent to (nconc (nreverse X) Y)."
(nconc (nreverse x) y))
+;;;###autoload
(defun list-length (x)
"Return the length of list X. Return nil if list is circular."
(let ((n 0) (fast x) (slow x))
@@ -548,6 +585,7 @@ If START or END is negative, it counts from the end."
(setq n (+ n 2) fast (cdr (cdr fast)) slow (cdr slow)))
(if fast (if (cdr fast) nil (1+ n)) n)))
+;;;###autoload
(defun tailp (sublist list)
"Return true if SUBLIST is a tail of LIST."
(while (and (consp list) (not (eq sublist list)))
@@ -559,6 +597,7 @@ If START or END is negative, it counts from the end."
;;; Property lists.
+;;;###autoload
(defun get* (sym tag &optional def) ; See compiler macro in cl-macs.el
"Return the value of SYMBOL's PROPNAME property, or DEFAULT if none.
\n(fn SYMBOL PROPNAME &optional DEFAULT)"
@@ -569,6 +608,7 @@ If START or END is negative, it counts from the end."
(setq plist (cdr (cdr plist))))
(if plist (car (cdr plist)) def)))))
+;;;###autoload
(defun getf (plist tag &optional def)
"Search PROPLIST for property PROPNAME; return its value or DEFAULT.
PROPLIST is a list of the sort returned by `symbol-plist'.
@@ -583,16 +623,19 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
(setq plist (cdr (cdr plist))))
(if plist (car (cdr plist)) def))))
+;;;###autoload
(defun cl-set-getf (plist tag val)
(let ((p plist))
(while (and p (not (eq (car p) tag))) (setq p (cdr (cdr p))))
(if p (progn (setcar (cdr p) val) plist) (list* tag val plist))))
+;;;###autoload
(defun cl-do-remf (plist tag)
(let ((p (cdr plist)))
(while (and (cdr p) (not (eq (car (cdr p)) tag))) (setq p (cdr (cdr p))))
(and (cdr p) (progn (setcdr p (cdr (cdr (cdr p)))) t))))
+;;;###autoload
(defun cl-remprop (sym tag)
"Remove from SYMBOL's plist the property PROPNAME and its value.
\n(fn SYMBOL PROPNAME)"
@@ -600,6 +643,7 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
(if (and plist (eq tag (car plist)))
(progn (setplist sym (cdr (cdr plist))) t)
(cl-do-remf plist tag))))
+;;;###autoload
(defalias 'remprop 'cl-remprop)
@@ -616,14 +660,22 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
(defvar cl-builtin-clrhash (symbol-function 'clrhash))
(defvar cl-builtin-maphash (symbol-function 'maphash))
+;;;###autoload
(defalias 'cl-gethash 'gethash)
+;;;###autoload
(defalias 'cl-puthash 'puthash)
+;;;###autoload
(defalias 'cl-remhash 'remhash)
+;;;###autoload
(defalias 'cl-clrhash 'clrhash)
+;;;###autoload
(defalias 'cl-maphash 'maphash)
;; These three actually didn't exist in Emacs-20.
+;;;###autoload
(defalias 'cl-make-hash-table 'make-hash-table)
+;;;###autoload
(defalias 'cl-hash-table-p 'hash-table-p)
+;;;###autoload
(defalias 'cl-hash-table-count 'hash-table-count)
;;; Some debugging aids.
@@ -672,6 +724,7 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
(defvar cl-macroexpand-cmacs nil)
(defvar cl-closure-vars nil)
+;;;###autoload
(defun cl-macroexpand-all (form &optional env)
"Expand all macro calls through a Lisp FORM.
This also does some trivial optimizations to make the form prettier."
@@ -753,6 +806,7 @@ This also does some trivial optimizations to make the form prettier."
(defun cl-macroexpand-body (body &optional env)
(mapcar (function (lambda (x) (cl-macroexpand-all x env))) body))
+;;;###autoload
(defun cl-prettyexpand (form &optional full)
(message "Expanding...")
(let ((cl-macroexpand-cmacs full) (cl-compiling-file full)
@@ -767,5 +821,9 @@ This also does some trivial optimizations to make the form prettier."
(run-hooks 'cl-extra-load-hook)
+;; Local variables:
+;; generated-autoload-file: "cl-loaddefs.el"
+;; End:
+
;; arch-tag: bcd03437-0871-43fb-a8f1-ad0e0b5427ed
;;; cl-extra.el ends here
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index 1589e19cbb..a46fead6eb 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -10,7 +10,7 @@
;;;;;; ceiling* floor* isqrt lcm gcd cl-progv-before cl-set-frame-visible-p
;;;;;; cl-map-overlays cl-map-intervals cl-map-keymap-recursively
;;;;;; notevery notany every some mapcon mapcan mapl maplist map
-;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "47c92504dda976a632c2c10bedd4b6a4")
+;;;;;; cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "53c2b3ede19dac62cff13a37f58cdf9c")
;;; Generated autoloads from cl-extra.el
(autoload (quote coerce) "cl-extra" "\
@@ -283,53 +283,53 @@ Not documented
;;;;;; do* do loop return-from return block etypecase typecase ecase
;;;;;; case load-time-value eval-when destructuring-bind function*
;;;;;; defmacro* defun* gentemp gensym cl-compile-time-init) "cl-macs"
-;;;;;; "cl-macs.el" "7ccc827d272482ca276937ca18a7895a")
+;;;;;; "cl-macs.el" "d1c9f68f599fbec644a06dd5cf520fb5")
;;; Generated autoloads from cl-macs.el
-(autoload (quote cl-compile-time-init) "cl-macs" "\
+(autoload 'cl-compile-time-init "cl-macs" "\
Not documented
\(fn)" nil nil)
-(autoload (quote gensym) "cl-macs" "\
+(autoload 'gensym "cl-macs" "\
Generate a new uninterned symbol.
The name is made by appending a number to PREFIX, default \"G\".
\(fn &optional PREFIX)" nil nil)
-(autoload (quote gentemp) "cl-macs" "\
+(autoload 'gentemp "cl-macs" "\
Generate a new interned symbol with a unique name.
The name is made by appending a number to PREFIX, default \"G\".
\(fn &optional PREFIX)" nil nil)
-(autoload (quote defun*) "cl-macs" "\
+(autoload 'defun* "cl-macs" "\
Define NAME as a function.
Like normal `defun', except ARGLIST allows full Common Lisp conventions,
and BODY is implicitly surrounded by (block NAME ...).
\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil (quote macro))
-(autoload (quote defmacro*) "cl-macs" "\
+(autoload 'defmacro* "cl-macs" "\
Define NAME as a macro.
Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
and BODY is implicitly surrounded by (block NAME ...).
\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil (quote macro))
-(autoload (quote function*) "cl-macs" "\
+(autoload 'function* "cl-macs" "\
Introduce a function.
Like normal `function', except that if argument is a lambda form,
its argument list allows full Common Lisp conventions.
\(fn FUNC)" nil (quote macro))
-(autoload (quote destructuring-bind) "cl-macs" "\
+(autoload 'destructuring-bind "cl-macs" "\
Not documented
\(fn ARGS EXPR &rest BODY)" nil (quote macro))
-(autoload (quote eval-when) "cl-macs" "\
+(autoload 'eval-when "cl-macs" "\
Control when BODY is evaluated.
If `compile' is in WHEN, BODY is evaluated when compiled at top-level.
If `load' is in WHEN, BODY is evaluated when loaded after top-level compile.
@@ -337,13 +337,13 @@ If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
\(fn (WHEN...) BODY...)" nil (quote macro))
-(autoload (quote load-time-value) "cl-macs" "\
+(autoload 'load-time-value "cl-macs" "\
Like `progn', but evaluates the body at load time.
The result of the body appears to the compiler as a quoted constant.
\(fn FORM &optional READ-ONLY)" nil (quote macro))
-(autoload (quote case) "cl-macs" "\
+(autoload 'case "cl-macs" "\
Eval EXPR and choose among clauses on that value.
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared
against each key in each KEYLIST; the corresponding BODY is evaluated.
@@ -354,13 +354,13 @@ Key values are compared by `eql'.
\(fn EXPR (KEYLIST BODY...)...)" nil (quote macro))
-(autoload (quote ecase) "cl-macs" "\
+(autoload 'ecase "cl-macs" "\
Like `case', but error if no case fits.
`otherwise'-clauses are not allowed.
\(fn EXPR (KEYLIST BODY...)...)" nil (quote macro))
-(autoload (quote typecase) "cl-macs" "\
+(autoload 'typecase "cl-macs" "\
Evals EXPR, chooses among clauses on that value.
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds,
@@ -369,13 +369,13 @@ final clause, and matches if no other keys match.
\(fn EXPR (TYPE BODY...)...)" nil (quote macro))
-(autoload (quote etypecase) "cl-macs" "\
+(autoload 'etypecase "cl-macs" "\
Like `typecase', but error if no case fits.
`otherwise'-clauses are not allowed.
\(fn EXPR (TYPE BODY...)...)" nil (quote macro))
-(autoload (quote block) "cl-macs" "\
+(autoload 'block "cl-macs" "\
Define a lexically-scoped block named NAME.
NAME may be any symbol. Code inside the BODY forms can call `return-from'
to jump prematurely out of the block. This differs from `catch' and `throw'
@@ -387,13 +387,13 @@ called from BODY.
\(fn NAME &rest BODY)" nil (quote macro))
-(autoload (quote return) "cl-macs" "\
+(autoload 'return "cl-macs" "\
Return from the block named nil.
This is equivalent to `(return-from nil RESULT)'.
\(fn &optional RESULT)" nil (quote macro))
-(autoload (quote return-from) "cl-macs" "\
+(autoload 'return-from "cl-macs" "\
Return from the block named NAME.
This jump out to the innermost enclosing `(block NAME ...)' form,
returning RESULT from that form (or nil if RESULT is omitted).
@@ -402,7 +402,7 @@ This is compatible with Common Lisp, but note that `defun' and
\(fn NAME &optional RESULT)" nil (quote macro))
-(autoload (quote loop) "cl-macs" "\
+(autoload 'loop "cl-macs" "\
The Common Lisp `loop' macro.
Valid clauses are:
for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
@@ -418,24 +418,24 @@ Valid clauses are:
\(fn CLAUSE...)" nil (quote macro))
-(autoload (quote do) "cl-macs" "\
+(autoload 'do "cl-macs" "\
The Common Lisp `do' loop.
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil (quote macro))
-(autoload (quote do*) "cl-macs" "\
+(autoload 'do* "cl-macs" "\
The Common Lisp `do*' loop.
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil (quote macro))
-(autoload (quote dolist) "cl-macs" "\
+(autoload 'dolist "cl-macs" "\
Loop over a list.
Evaluate BODY with VAR bound to each `car' from LIST, in turn.
Then evaluate RESULT to get return value, default nil.
\(fn (VAR LIST [RESULT]) BODY...)" nil (quote macro))
-(autoload (quote dotimes) "cl-macs" "\
+(autoload 'dotimes "cl-macs" "\
Loop a certain number of times.
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
to COUNT, exclusive. Then evaluate RESULT to get return value, default
@@ -443,26 +443,26 @@ nil.
\(fn (VAR COUNT [RESULT]) BODY...)" nil (quote macro))
-(autoload (quote do-symbols) "cl-macs" "\
+(autoload 'do-symbols "cl-macs" "\
Loop over all symbols.
Evaluate BODY with VAR bound to each interned symbol, or to each symbol
from OBARRAY.
\(fn (VAR [OBARRAY [RESULT]]) BODY...)" nil (quote macro))
-(autoload (quote do-all-symbols) "cl-macs" "\
+(autoload 'do-all-symbols "cl-macs" "\
Not documented
\(fn SPEC &rest BODY)" nil (quote macro))
-(autoload (quote psetq) "cl-macs" "\
+(autoload 'psetq "cl-macs" "\
Set SYMs to the values VALs in parallel.
This is like `setq', except that all VAL forms are evaluated (in order)
before assigning any symbols SYM to the corresponding values.
\(fn SYM VAL SYM VAL ...)" nil (quote macro))
-(autoload (quote progv) "cl-macs" "\
+(autoload 'progv "cl-macs" "\
Bind SYMBOLS to VALUES dynamically in BODY.
The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
Each symbol in the first list is bound to the corresponding value in the
@@ -472,7 +472,7 @@ a `let' form, except that the list of symbols can be computed at run-time.
\(fn SYMBOLS VALUES &rest BODY)" nil (quote macro))
-(autoload (quote flet) "cl-macs" "\
+(autoload 'flet "cl-macs" "\
Make temporary function definitions.
This is an analogue of `let' that operates on the function cell of FUNC
rather than its value cell. The FORMs are evaluated with the specified
@@ -481,41 +481,41 @@ go back to their previous definitions, or lack thereof).
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil (quote macro))
-(autoload (quote labels) "cl-macs" "\
+(autoload 'labels "cl-macs" "\
Make temporary function bindings.
This is like `flet', except the bindings are lexical instead of dynamic.
Unlike `flet', this macro is fully compliant with the Common Lisp standard.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil (quote macro))
-(autoload (quote macrolet) "cl-macs" "\
+(autoload 'macrolet "cl-macs" "\
Make temporary macro definitions.
This is like `flet', but for macros instead of functions.
\(fn ((NAME ARGLIST BODY...) ...) FORM...)" nil (quote macro))
-(autoload (quote symbol-macrolet) "cl-macs" "\
+(autoload 'symbol-macrolet "cl-macs" "\
Make symbol macro definitions.
Within the body FORMs, references to the variable NAME will be replaced
by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
\(fn ((NAME EXPANSION) ...) FORM...)" nil (quote macro))
-(autoload (quote lexical-let) "cl-macs" "\
+(autoload 'lexical-let "cl-macs" "\
Like `let', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
lexical closures as in Common Lisp.
\(fn VARLIST BODY)" nil (quote macro))
-(autoload (quote lexical-let*) "cl-macs" "\
+(autoload 'lexical-let* "cl-macs" "\
Like `let*', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
lexical closures as in Common Lisp.
\(fn VARLIST BODY)" nil (quote macro))
-(autoload (quote multiple-value-bind) "cl-macs" "\
+(autoload 'multiple-value-bind "cl-macs" "\
Collect multiple return values.
FORM must return a list; the BODY is then executed with the first N elements
of this list bound (`let'-style) to each of the symbols SYM in turn. This
@@ -525,7 +525,7 @@ a synonym for (list A B C).
\(fn (SYM...) FORM BODY)" nil (quote macro))
-(autoload (quote multiple-value-setq) "cl-macs" "\
+(autoload 'multiple-value-setq "cl-macs" "\
Collect multiple return values.
FORM must return a list; the first N elements of this list are stored in
each of the symbols SYM in turn. This is analogous to the Common Lisp
@@ -534,22 +534,22 @@ values. For compatibility, (values A B C) is a synonym for (list A B C).
\(fn (SYM...) FORM)" nil (quote macro))
-(autoload (quote locally) "cl-macs" "\
+(autoload 'locally "cl-macs" "\
Not documented
\(fn &rest BODY)" nil (quote macro))
-(autoload (quote the) "cl-macs" "\
+(autoload 'the "cl-macs" "\
Not documented
\(fn TYPE FORM)" nil (quote macro))
-(autoload (quote declare) "cl-macs" "\
+(autoload 'declare "cl-macs" "\
Not documented
\(fn &rest SPECS)" nil (quote macro))
-(autoload (quote define-setf-method) "cl-macs" "\
+(autoload 'define-setf-method "cl-macs" "\
Define a `setf' method.
This method shows how to handle `setf's to places of the form (NAME ARGS...).
The argument forms ARGS are bound according to ARGLIST, as if NAME were
@@ -560,7 +560,7 @@ form. See `defsetf' for a simpler way to define most setf-methods.
\(fn NAME ARGLIST BODY...)" nil (quote macro))
-(autoload (quote defsetf) "cl-macs" "\
+(autoload 'defsetf "cl-macs" "\
Define a `setf' method.
This macro is an easy-to-use substitute for `define-setf-method' that works
well for simple place forms. In the simple `defsetf' form, `setf's of
@@ -581,14 +581,14 @@ Example:
\(fn NAME [FUNC | ARGLIST (STORE) BODY...])" nil (quote macro))
-(autoload (quote get-setf-method) "cl-macs" "\
+(autoload 'get-setf-method "cl-macs" "\
Return a list of five values describing the setf-method for PLACE.
PLACE may be any Lisp form which can appear as the PLACE argument to
a macro like `setf' or `incf'.
\(fn PLACE &optional ENV)" nil nil)
-(autoload (quote setf) "cl-macs" "\
+(autoload 'setf "cl-macs" "\
Set each PLACE to the value of its VAL.
This is a generalized version of `setq'; the PLACEs may be symbolic
references such as (car x) or (aref x i), as well as plain symbols.
@@ -597,40 +597,40 @@ The return value is the last VAL in the list.
\(fn PLACE VAL PLACE VAL ...)" nil (quote macro))
-(autoload (quote psetf) "cl-macs" "\
+(autoload 'psetf "cl-macs" "\
Set PLACEs to the values VALs in parallel.
This is like `setf', except that all VAL forms are evaluated (in order)
before assigning any PLACEs to the corresponding values.
\(fn PLACE VAL PLACE VAL ...)" nil (quote macro))
-(autoload (quote cl-do-pop) "cl-macs" "\
+(autoload 'cl-do-pop "cl-macs" "\
Not documented
\(fn PLACE)" nil nil)
-(autoload (quote remf) "cl-macs" "\
+(autoload 'remf "cl-macs" "\
Remove TAG from property list PLACE.
PLACE may be a symbol, or any generalized variable allowed by `setf'.
The form returns true if TAG was found and removed, nil otherwise.
\(fn PLACE TAG)" nil (quote macro))
-(autoload (quote shiftf) "cl-macs" "\
+(autoload 'shiftf "cl-macs" "\
Shift left among PLACEs.
Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
\(fn PLACE... VAL)" nil (quote macro))
-(autoload (quote rotatef) "cl-macs" "\
+(autoload 'rotatef "cl-macs" "\
Rotate left among PLACEs.
Example: (rotatef A B C) sets A to B, B to C, and C to A. It returns nil.
Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
\(fn PLACE...)" nil (quote macro))
-(autoload (quote letf) "cl-macs" "\
+(autoload 'letf "cl-macs" "\
Temporarily bind to PLACEs.
This is the analogue of `let', but with generalized variables (in the
sense of `setf') for the PLACEs. Each PLACE is set to the corresponding
@@ -642,7 +642,7 @@ the PLACE is not modified before executing BODY.
\(fn ((PLACE VALUE) ...) BODY...)" nil (quote macro))
-(autoload (quote letf*) "cl-macs" "\
+(autoload 'letf* "cl-macs" "\
Temporarily bind to PLACEs.
This is the analogue of `let*', but with generalized variables (in the
sense of `setf') for the PLACEs. Each PLACE is set to the corresponding
@@ -654,27 +654,27 @@ the PLACE is not modified before executing BODY.
\(fn ((PLACE VALUE) ...) BODY...)" nil (quote macro))
-(autoload (quote callf) "cl-macs" "\
+(autoload 'callf "cl-macs" "\
Set PLACE to (FUNC PLACE ARGS...).
FUNC should be an unquoted function name. PLACE may be a symbol,
or any generalized variable allowed by `setf'.
\(fn FUNC PLACE ARGS...)" nil (quote macro))
-(autoload (quote callf2) "cl-macs" "\
+(autoload 'callf2 "cl-macs" "\
Set PLACE to (FUNC ARG1 PLACE ARGS...).
Like `callf', but PLACE is the second argument of FUNC, not the first.
\(fn FUNC ARG1 PLACE ARGS...)" nil (quote macro))
-(autoload (quote define-modify-macro) "cl-macs" "\
+(autoload 'define-modify-macro "cl-macs" "\
Define a `setf'-like modify macro.
If NAME is called, it combines its PLACE argument with the other arguments
from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)
\(fn NAME ARGLIST FUNC &optional DOC)" nil (quote macro))
-(autoload (quote defstruct) "cl-macs" "\
+(autoload 'defstruct "cl-macs" "\
Define a struct type.
This macro defines a new Lisp data type called NAME, which contains data
stored in SLOTs. This defines a `make-NAME' constructor, a `copy-NAME'
@@ -682,24 +682,24 @@ copier, a `NAME-p' predicate, and setf-able `NAME-SLOT' accessors.
\(fn (NAME OPTIONS...) (SLOT SLOT-OPTS...)...)" nil (quote macro))
-(autoload (quote cl-struct-setf-expander) "cl-macs" "\
+(autoload 'cl-struct-setf-expander "cl-macs" "\
Not documented
\(fn X NAME ACCESSOR PRED-FORM POS)" nil nil)
-(autoload (quote typep) "cl-macs" "\
+(autoload 'typep "cl-macs" "\
Check that OBJECT is of type TYPE.
TYPE is a Common Lisp-style type specifier.
\(fn OBJECT TYPE)" nil nil)
-(autoload (quote check-type) "cl-macs" "\
+(autoload 'check-type "cl-macs" "\
Verify that FORM is of type TYPE; signal an error if not.
STRING is an optional description of the desired type.
\(fn FORM TYPE &optional STRING)" nil (quote macro))
-(autoload (quote assert) "cl-macs" "\
+(autoload 'assert "cl-macs" "\
Verify that FORM returns non-nil; signal an error if not.
Second arg SHOW-ARGS means to include arguments of FORM in message.
Other args STRING and ARGS... are arguments to be passed to `error'.
@@ -708,13 +708,13 @@ omitted, a default message listing FORM itself is used.
\(fn FORM &optional SHOW-ARGS STRING &rest ARGS)" nil (quote macro))
-(autoload (quote ignore-errors) "cl-macs" "\
+(autoload 'ignore-errors "cl-macs" "\
Execute BODY; if an error occurs, return nil.
Otherwise, return result of last form in BODY.
\(fn &rest BODY)" nil (quote macro))
-(autoload (quote define-compiler-macro) "cl-macs" "\
+(autoload 'define-compiler-macro "cl-macs" "\
Define a compiler-only macro.
This is like `defmacro', but macro expansion occurs only if the call to
FUNC is compiled (i.e., not interpreted). Compiler macros should be used
@@ -728,7 +728,7 @@ and then returning foo.
\(fn FUNC ARGS &rest BODY)" nil (quote macro))
-(autoload (quote compiler-macroexpand) "cl-macs" "\
+(autoload 'compiler-macroexpand "cl-macs" "\
Not documented
\(fn FORM)" nil nil)
@@ -745,7 +745,7 @@ Not documented
;;;;;; find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not
;;;;;; substitute-if substitute delete-duplicates remove-duplicates
;;;;;; delete-if-not delete-if delete* remove-if-not remove-if remove*
-;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "8805f76626399794931f5db36ddf855f")
+;;;;;; replace fill reduce) "cl-seq" "cl-seq.el" "c972a97c053d4e001ac1d1012c315b28")
;;; Generated autoloads from cl-seq.el
(autoload (quote reduce) "cl-seq" "\
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index e4a84e44e6..2a4b69d2af 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -58,8 +58,8 @@
(defvar cl-optimize-speed)
-;;; This kludge allows macros which use cl-transform-function-property
-;;; to be called at compile-time.
+;; This kludge allows macros which use cl-transform-function-property
+;; to be called at compile-time.
(require
(progn
@@ -75,6 +75,7 @@
(defvar cl-old-bc-file-form nil)
+;;;###autoload
(defun cl-compile-time-init ()
(run-hooks 'cl-hack-bytecomp-hook))
@@ -165,6 +166,7 @@
;;; Symbols.
(defvar *gensym-counter*)
+;;;###autoload
(defun gensym (&optional prefix)
"Generate a new uninterned symbol.
The name is made by appending a number to PREFIX, default \"G\"."
@@ -174,6 +176,7 @@ The name is made by appending a number to PREFIX, default \"G\"."
(setq *gensym-counter* (1+ *gensym-counter*))))))
(make-symbol (format "%s%d" pfix num))))
+;;;###autoload
(defun gentemp (&optional prefix)
"Generate a new interned symbol with a unique name.
The name is made by appending a number to PREFIX, default \"G\"."
@@ -186,6 +189,7 @@ The name is made by appending a number to PREFIX, default \"G\"."
;;; Program structure.
+;;;###autoload
(defmacro defun* (name args &rest body)
"Define NAME as a function.
Like normal `defun', except ARGLIST allows full Common Lisp conventions,
@@ -196,6 +200,7 @@ and BODY is implicitly surrounded by (block NAME ...).
(form (list* 'defun name (cdr res))))
(if (car res) (list 'progn (car res) form) form)))
+;;;###autoload
(defmacro defmacro* (name args &rest body)
"Define NAME as a macro.
Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
@@ -206,6 +211,7 @@ and BODY is implicitly surrounded by (block NAME ...).
(form (list* 'defmacro name (cdr res))))
(if (car res) (list 'progn (car res) form) form)))
+;;;###autoload
(defmacro function* (func)
"Introduce a function.
Like normal `function', except that if argument is a lambda form,
@@ -426,6 +432,7 @@ its argument list allows full Common Lisp conventions."
(setq res (nconc res (cl-arglist-args arg))))))
(nconc res (and args (list args))))))
+;;;###autoload
(defmacro destructuring-bind (args expr &rest body)
(let* ((bind-lets nil) (bind-forms nil) (bind-inits nil)
(bind-defs nil) (bind-block 'cl-none))
@@ -439,6 +446,7 @@ its argument list allows full Common Lisp conventions."
(defvar cl-not-toplevel nil)
+;;;###autoload
(defmacro eval-when (when &rest body)
"Control when BODY is evaluated.
If `compile' is in WHEN, BODY is evaluated when compiled at top-level.
@@ -470,6 +478,7 @@ If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
form)))
(t (eval form) form)))
+;;;###autoload
(defmacro load-time-value (form &optional read-only)
"Like `progn', but evaluates the body at load time.
The result of the body appears to the compiler as a quoted constant."
@@ -492,6 +501,7 @@ The result of the body appears to the compiler as a quoted constant."
;;; Conditional control structures.
+;;;###autoload
(defmacro case (expr &rest clauses)
"Eval EXPR and choose among clauses on that value.
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared
@@ -526,12 +536,14 @@ Key values are compared by `eql'.
(if (eq temp expr) body
(list 'let (list (list temp expr)) body))))
+;;;###autoload
(defmacro ecase (expr &rest clauses)
"Like `case', but error if no case fits.
`otherwise'-clauses are not allowed.
\n(fn EXPR (KEYLIST BODY...)...)"
(list* 'case expr (append clauses '((ecase-error-flag)))))
+;;;###autoload
(defmacro typecase (expr &rest clauses)
"Evals EXPR, chooses among clauses on that value.
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
@@ -558,6 +570,7 @@ final clause, and matches if no other keys match.
(if (eq temp expr) body
(list 'let (list (list temp expr)) body))))
+;;;###autoload
(defmacro etypecase (expr &rest clauses)
"Like `typecase', but error if no case fits.
`otherwise'-clauses are not allowed.
@@ -567,6 +580,7 @@ final clause, and matches if no other keys match.
;;; Blocks and exits.
+;;;###autoload
(defmacro block (name &rest body)
"Define a lexically-scoped block named NAME.
NAME may be any symbol. Code inside the BODY forms can call `return-from'
@@ -602,11 +616,13 @@ called from BODY."
(if cl-found (setcdr cl-found t)))
(byte-compile-normal-call (cons 'throw (cdr cl-form))))
+;;;###autoload
(defmacro return (&optional result)
"Return from the block named nil.
This is equivalent to `(return-from nil RESULT)'."
(list 'return-from nil result))
+;;;###autoload
(defmacro return-from (name &optional result)
"Return from the block named NAME.
This jump out to the innermost enclosing `(block NAME ...)' form,
@@ -626,6 +642,7 @@ This is compatible with Common Lisp, but note that `defun' and
(defvar loop-result) (defvar loop-result-explicit)
(defvar loop-result-var) (defvar loop-steps) (defvar loop-symbol-macs)
+;;;###autoload
(defmacro loop (&rest args)
"The Common Lisp `loop' macro.
Valid clauses are:
@@ -1185,12 +1202,14 @@ Valid clauses are:
;;; Other iteration control structures.
+;;;###autoload
(defmacro do (steps endtest &rest body)
"The Common Lisp `do' loop.
\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
(cl-expand-do-loop steps endtest body nil))
+;;;###autoload
(defmacro do* (steps endtest &rest body)
"The Common Lisp `do*' loop.
@@ -1218,6 +1237,7 @@ Valid clauses are:
(apply 'append sets)))))))
(or (cdr endtest) '(nil)))))
+;;;###autoload
(defmacro dolist (spec &rest body)
"Loop over a list.
Evaluate BODY with VAR bound to each `car' from LIST, in turn.
@@ -1234,6 +1254,7 @@ Then evaluate RESULT to get return value, default nil.
(cons (list 'setq (car spec) nil) (cdr (cdr spec)))
'(nil))))))
+;;;###autoload
(defmacro dotimes (spec &rest body)
"Loop a certain number of times.
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
@@ -1248,6 +1269,7 @@ nil.
(append body (list (list 'incf (car spec)))))
(or (cdr (cdr spec)) '(nil))))))
+;;;###autoload
(defmacro do-symbols (spec &rest body)
"Loop over all symbols.
Evaluate BODY with VAR bound to each interned symbol, or to each symbol
@@ -1262,12 +1284,14 @@ from OBARRAY.
(and (cadr spec) (list (cadr spec))))
(caddr spec))))
+;;;###autoload
(defmacro do-all-symbols (spec &rest body)
(list* 'do-symbols (list (car spec) nil (cadr spec)) body))
;;; Assignments.
+;;;###autoload
(defmacro psetq (&rest args)
"Set SYMs to the values VALs in parallel.
This is like `setq', except that all VAL forms are evaluated (in order)
@@ -1279,6 +1303,7 @@ before assigning any symbols SYM to the corresponding values.
;;; Binding control structures.
+;;;###autoload
(defmacro progv (symbols values &rest body)
"Bind SYMBOLS to VALUES dynamically in BODY.
The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
@@ -1292,6 +1317,7 @@ a `let' form, except that the list of symbols can be computed at run-time."
'(cl-progv-after))))
;;; This should really have some way to shadow 'byte-compile properties, etc.
+;;;###autoload
(defmacro flet (bindings &rest body)
"Make temporary function definitions.
This is an analogue of `let' that operates on the function cell of FUNC
@@ -1319,6 +1345,7 @@ go back to their previous definitions, or lack thereof).
bindings)
body))
+;;;###autoload
(defmacro labels (bindings &rest body)
"Make temporary function bindings.
This is like `flet', except the bindings are lexical instead of dynamic.
@@ -1343,6 +1370,7 @@ Unlike `flet', this macro is fully compliant with the Common Lisp standard.
;; The following ought to have a better definition for use with newer
;; byte compilers.
+;;;###autoload
(defmacro macrolet (bindings &rest body)
"Make temporary macro definitions.
This is like `flet', but for macros instead of functions.
@@ -1359,6 +1387,7 @@ This is like `flet', but for macros instead of functions.
(cons (list* name 'lambda (cdr res))
cl-macro-environment))))))
+;;;###autoload
(defmacro symbol-macrolet (bindings &rest body)
"Make symbol macro definitions.
Within the body FORMs, references to the variable NAME will be replaced
@@ -1375,6 +1404,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
cl-macro-environment)))))
(defvar cl-closure-vars nil)
+;;;###autoload
(defmacro lexical-let (bindings &rest body)
"Like `let', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
@@ -1418,6 +1448,7 @@ lexical closures as in Common Lisp.
vars))
ebody))))
+;;;###autoload
(defmacro lexical-let* (bindings &rest body)
"Like `let*', but lexically scoped.
The main visible difference is that lambdas inside BODY will create
@@ -1438,6 +1469,7 @@ lexical closures as in Common Lisp.
;;; Multiple values.
+;;;###autoload
(defmacro multiple-value-bind (vars form &rest body)
"Collect multiple return values.
FORM must return a list; the BODY is then executed with the first N elements
@@ -1455,6 +1487,7 @@ a synonym for (list A B C).
vars))
body)))
+;;;###autoload
(defmacro multiple-value-setq (vars form)
"Collect multiple return values.
FORM must return a list; the first N elements of this list are stored in
@@ -1481,7 +1514,9 @@ values. For compatibility, (values A B C) is a synonym for (list A B C).
;;; Declarations.
+;;;###autoload
(defmacro locally (&rest body) (cons 'progn body))
+;;;###autoload
(defmacro the (type form) form)
(defvar cl-proclaim-history t) ; for future compilers
@@ -1536,6 +1571,7 @@ values. For compatibility, (values A B C) is a synonym for (list A B C).
(while p (cl-do-proclaim (pop p) t))
(setq cl-proclaims-deferred nil))
+;;;###autoload
(defmacro declare (&rest specs)
(if (cl-compiling-file)
(while specs
@@ -1547,6 +1583,7 @@ values. For compatibility, (values A B C) is a synonym for (list A B C).
;;; Generalized variables.
+;;;###autoload
(defmacro define-setf-method (func args &rest body)
"Define a `setf' method.
This method shows how to handle `setf's to places of the form (NAME ARGS...).
@@ -1565,8 +1602,9 @@ form. See `defsetf' for a simpler way to define most setf-methods.
func 'setf-method (cons args body)))))
(defalias 'define-setf-expander 'define-setf-method)
+;;;###autoload
(defmacro defsetf (func arg1 &rest args)
- "(defsetf NAME FUNC): define a `setf' method.
+ "Define a `setf' method.
This macro is an easy-to-use substitute for `define-setf-method' that works
well for simple place forms. In the simple `defsetf' form, `setf's of
the form (setf (NAME ARGS...) VAL) are transformed to function or macro
@@ -1840,6 +1878,7 @@ Example:
(list 'substring (nth 4 method) from-temp to-temp))))
;;; Getting and optimizing setf-methods.
+;;;###autoload
(defun get-setf-method (place &optional env)
"Return a list of five values describing the setf-method for PLACE.
PLACE may be any Lisp form which can appear as the PLACE argument to
@@ -1907,6 +1946,7 @@ a macro like `setf' or `incf'."
(not (eq (car-safe (symbol-function (car form))) 'macro))))
;;; The standard modify macros.
+;;;###autoload
(defmacro setf (&rest args)
"Set each PLACE to the value of its VAL.
This is a generalized version of `setq'; the PLACEs may be symbolic
@@ -1925,6 +1965,7 @@ The return value is the last VAL in the list.
(store (cl-setf-do-store (nth 1 method) (nth 1 args))))
(if (car method) (list 'let* (car method) store) store)))))
+;;;###autoload
(defmacro psetf (&rest args)
"Set PLACEs to the values VALs in parallel.
This is like `setf', except that all VAL forms are evaluated (in order)
@@ -1948,6 +1989,7 @@ before assigning any PLACEs to the corresponding values.
(setq expr (list 'setf (cadr args) (list 'prog1 (car args) expr))))
(list 'progn expr nil)))))
+;;;###autoload
(defun cl-do-pop (place)
(if (cl-simple-expr-p place)
(list 'prog1 (list 'car place) (list 'setf place (list 'cdr place)))
@@ -1960,6 +2002,7 @@ before assigning any PLACEs to the corresponding values.
(list 'car temp)
(cl-setf-do-store (nth 1 method) (list 'cdr temp)))))))
+;;;###autoload
(defmacro remf (place tag)
"Remove TAG from property list PLACE.
PLACE may be a symbol, or any generalized variable allowed by `setf'.
@@ -1980,6 +2023,7 @@ The form returns true if TAG was found and removed, nil otherwise."
t)
(list 'cl-do-remf tval ttag)))))
+;;;###autoload
(defmacro shiftf (place &rest args)
"Shift left among PLACEs.
Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
@@ -1995,6 +2039,7 @@ Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
(prog1 ,(nth 2 method)
,(cl-setf-do-store (nth 1 method) `(shiftf ,@args))))))))
+;;;###autoload
(defmacro rotatef (&rest args)
"Rotate left among PLACEs.
Example: (rotatef A B C) sets A to B, B to C, and C to A. It returns nil.
@@ -2020,6 +2065,7 @@ Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
(list 'let* (append (car method) (list (list temp (nth 2 method))))
(cl-setf-do-store (nth 1 method) form) nil)))))
+;;;###autoload
(defmacro letf (bindings &rest body)
"Temporarily bind to PLACEs.
This is the analogue of `let', but with generalized variables (in the
@@ -2076,6 +2122,7 @@ the PLACE is not modified before executing BODY.
rev (cdr rev))))
(list* 'let* lets body))))
+;;;###autoload
(defmacro letf* (bindings &rest body)
"Temporarily bind to PLACEs.
This is the analogue of `let*', but with generalized variables (in the
@@ -2094,6 +2141,7 @@ the PLACE is not modified before executing BODY.
(setq body (list (list* 'letf (list (pop bindings)) body))))
(car body)))
+;;;###autoload
(defmacro callf (func place &rest args)
"Set PLACE to (FUNC PLACE ARGS...).
FUNC should be an unquoted function name. PLACE may be a symbol,
@@ -2108,6 +2156,7 @@ or any generalized variable allowed by `setf'.
(list* 'funcall (list 'function func)
rargs))))))
+;;;###autoload
(defmacro callf2 (func arg1 place &rest args)
"Set PLACE to (FUNC ARG1 PLACE ARGS...).
Like `callf', but PLACE is the second argument of FUNC, not the first.
@@ -2124,6 +2173,7 @@ Like `callf', but PLACE is the second argument of FUNC, not the first.
(list* 'funcall (list 'function func)
rargs)))))))
+;;;###autoload
(defmacro define-modify-macro (name arglist func &optional doc)
"Define a `setf'-like modify macro.
If NAME is called, it combines its PLACE argument with the other arguments
@@ -2138,6 +2188,7 @@ from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
;;; Structures.
+;;;###autoload
(defmacro defstruct (struct &rest descs)
"Define a struct type.
This macro defines a new Lisp data type called NAME, which contains data
@@ -2362,6 +2413,7 @@ copier, a `NAME-p' predicate, and setf-able `NAME-SLOT' accessors.
forms)
(cons 'progn (nreverse (cons (list 'quote name) forms)))))
+;;;###autoload
(defun cl-struct-setf-expander (x name accessor pred-form pos)
(let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--")))
(list (list temp) (list x) (list store)
@@ -2430,11 +2482,13 @@ The type name can then be used in `typecase', `check-type', etc."
((eq (car type) 'satisfies) (list (cadr type) val))
(t (error "Bad type spec: %s" type)))))
+;;;###autoload
(defun typep (object type) ; See compiler macro below.
"Check that OBJECT is of type TYPE.
TYPE is a Common Lisp-style type specifier."
(eval (cl-make-type-test 'object type)))
+;;;###autoload
(defmacro check-type (form type &optional string)
"Verify that FORM is of type TYPE; signal an error if not.
STRING is an optional description of the desired type."
@@ -2449,6 +2503,7 @@ STRING is an optional description of the desired type."
(if (eq temp form) (list 'progn body nil)
(list 'let (list (list temp form)) body nil)))))
+;;;###autoload
(defmacro assert (form &optional show-args string &rest args)
"Verify that FORM returns non-nil; signal an error if not.
Second arg SHOW-ARGS means to include arguments of FORM in message.
@@ -2470,6 +2525,7 @@ omitted, a default message listing FORM itself is used."
(list* 'list (list 'quote form) sargs))))
nil))))
+;;;###autoload
(defmacro ignore-errors (&rest body)
"Execute BODY; if an error occurs, return nil.
Otherwise, return result of last form in BODY."
@@ -2478,6 +2534,7 @@ Otherwise, return result of last form in BODY."
;;; Compiler macros.
+;;;###autoload
(defmacro define-compiler-macro (func args &rest body)
"Define a compiler-only macro.
This is like `defmacro', but macro expansion occurs only if the call to
@@ -2501,6 +2558,7 @@ and then returning foo."
(list 'put (list 'quote func) '(quote byte-compile)
'(quote cl-byte-compile-compiler-macro)))))
+;;;###autoload
(defun compiler-macroexpand (form)
(while
(let ((func (car-safe form)) (handler nil))
@@ -2556,9 +2614,9 @@ surrounded by (block NAME ...).
(if lets (list 'let lets body) body))))
-;;; Compile-time optimizations for some functions defined in this package.
-;;; Note that cl.el arranges to force cl-macs to be loaded at compile-time,
-;;; mainly to make sure these macros will be present.
+;; Compile-time optimizations for some functions defined in this package.
+;; Note that cl.el arranges to force cl-macs to be loaded at compile-time,
+;; mainly to make sure these macros will be present.
(put 'eql 'byte-compile nil)
(define-compiler-macro eql (&whole form a b)
@@ -2669,9 +2727,10 @@ surrounded by (block NAME ...).
(run-hooks 'cl-macs-load-hook)
-;;; Local variables:
-;;; byte-compile-warnings: (redefine callargs free-vars unresolved obsolete noruntime)
-;;; End:
+;; Local variables:
+;; byte-compile-warnings: (redefine callargs free-vars unresolved obsolete noruntime)
+;; generated-autoload-file: "cl-loaddefs.el"
+;; End:
;; arch-tag: afd947a6-b553-4df1-bba5-000be6388f46
;;; cl-macs.el ends here
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index b418568147..8016b75aad 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -125,6 +125,7 @@
(defvar cl-key)
+;;;###autoload
(defun reduce (cl-func cl-seq &rest cl-keys)
"Reduce two-argument FUNCTION across SEQ.
\nKeywords supported: :start :end :from-end :initial-value :key
@@ -145,6 +146,7 @@
(cl-check-key (pop cl-seq))))))
cl-accum)))
+;;;###autoload
(defun fill (seq item &rest cl-keys)
"Fill the elements of SEQ with ITEM.
\nKeywords supported: :start :end
@@ -164,6 +166,7 @@
(setq cl-start (1+ cl-start)))))
seq))
+;;;###autoload
(defun replace (cl-seq1 cl-seq2 &rest cl-keys)
"Replace the elements of SEQ1 with the elements of SEQ2.
SEQ1 is destructively modified, then returned.
@@ -206,6 +209,7 @@ SEQ1 is destructively modified, then returned.
(setq cl-start2 (1+ cl-start2) cl-start1 (1+ cl-start1))))))
cl-seq1))
+;;;###autoload
(defun remove* (cl-item cl-seq &rest cl-keys)
"Remove all occurrences of ITEM in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -251,6 +255,7 @@ to avoid corrupting the original SEQ.
cl-seq))
cl-seq)))))
+;;;###autoload
(defun remove-if (cl-pred cl-list &rest cl-keys)
"Remove all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -259,6 +264,7 @@ to avoid corrupting the original SEQ.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'remove* nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun remove-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -267,6 +273,7 @@ to avoid corrupting the original SEQ.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'remove* nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun delete* (cl-item cl-seq &rest cl-keys)
"Remove all occurrences of ITEM in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -310,6 +317,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
cl-seq)
(apply 'remove* cl-item cl-seq cl-keys)))))
+;;;###autoload
(defun delete-if (cl-pred cl-list &rest cl-keys)
"Remove all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -317,6 +325,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'delete* nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun delete-if-not (cl-pred cl-list &rest cl-keys)
"Remove all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -324,12 +333,14 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'delete* nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun remove-duplicates (cl-seq &rest cl-keys)
"Return a copy of SEQ with all duplicate elements removed.
\nKeywords supported: :test :test-not :key :start :end :from-end
\n(fn SEQ [KEYWORD VALUE]...)"
(cl-delete-duplicates cl-seq cl-keys t))
+;;;###autoload
(defun delete-duplicates (cl-seq &rest cl-keys)
"Remove all duplicate elements from SEQ (destructively).
\nKeywords supported: :test :test-not :key :start :end :from-end
@@ -376,6 +387,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
(let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil)))
(if (stringp cl-seq) (concat cl-res) (vconcat cl-res)))))
+;;;###autoload
(defun substitute (cl-new cl-old cl-seq &rest cl-keys)
"Substitute NEW for OLD in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -397,6 +409,7 @@ to avoid corrupting the original SEQ.
(apply 'nsubstitute cl-new cl-old cl-seq :count cl-count
:start cl-i cl-keys))))))
+;;;###autoload
(defun substitute-if (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -405,6 +418,7 @@ to avoid corrupting the original SEQ.
\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'substitute cl-new nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a non-destructive function; it makes a copy of SEQ if necessary
@@ -413,6 +427,7 @@ to avoid corrupting the original SEQ.
\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
"Substitute NEW for OLD in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -446,6 +461,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
(setq cl-start (1+ cl-start))))))
cl-seq))
+;;;###autoload
(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -453,6 +469,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
"Substitute NEW for all items not satisfying PREDICATE in SEQ.
This is a destructive function; it reuses the storage of SEQ whenever possible.
@@ -460,6 +477,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun find (cl-item cl-seq &rest cl-keys)
"Find the first occurrence of ITEM in SEQ.
Return the matching ITEM, or nil if not found.
@@ -468,6 +486,7 @@ Return the matching ITEM, or nil if not found.
(let ((cl-pos (apply 'position cl-item cl-seq cl-keys)))
(and cl-pos (elt cl-seq cl-pos))))
+;;;###autoload
(defun find-if (cl-pred cl-list &rest cl-keys)
"Find the first item satisfying PREDICATE in SEQ.
Return the matching item, or nil if not found.
@@ -475,6 +494,7 @@ Return the matching item, or nil if not found.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'find nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun find-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item not satisfying PREDICATE in SEQ.
Return the matching item, or nil if not found.
@@ -482,6 +502,7 @@ Return the matching item, or nil if not found.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'find nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun position (cl-item cl-seq &rest cl-keys)
"Find the first occurrence of ITEM in SEQ.
Return the index of the matching item, or nil if not found.
@@ -512,6 +533,7 @@ Return the index of the matching item, or nil if not found.
(setq cl-start (1+ cl-start)))
(and (< cl-start cl-end) cl-start))))
+;;;###autoload
(defun position-if (cl-pred cl-list &rest cl-keys)
"Find the first item satisfying PREDICATE in SEQ.
Return the index of the matching item, or nil if not found.
@@ -519,6 +541,7 @@ Return the index of the matching item, or nil if not found.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'position nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun position-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item not satisfying PREDICATE in SEQ.
Return the index of the matching item, or nil if not found.
@@ -526,6 +549,7 @@ Return the index of the matching item, or nil if not found.
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'position nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun count (cl-item cl-seq &rest cl-keys)
"Count the number of occurrences of ITEM in SEQ.
\nKeywords supported: :test :test-not :key :start :end
@@ -540,18 +564,21 @@ Return the index of the matching item, or nil if not found.
(setq cl-start (1+ cl-start)))
cl-count)))
+;;;###autoload
(defun count-if (cl-pred cl-list &rest cl-keys)
"Count the number of items satisfying PREDICATE in SEQ.
\nKeywords supported: :key :start :end
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'count nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun count-if-not (cl-pred cl-list &rest cl-keys)
"Count the number of items not satisfying PREDICATE in SEQ.
\nKeywords supported: :key :start :end
\n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
(apply 'count nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
"Compare SEQ1 with SEQ2, return index of first mismatching element.
Return nil if the sequences match. If one sequence is a prefix of the
@@ -582,6 +609,7 @@ other, the return value indicates the end of the shorter sequence.
(and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
cl-start1)))))
+;;;###autoload
(defun search (cl-seq1 cl-seq2 &rest cl-keys)
"Search for SEQ1 as a subsequence of SEQ2.
Return the index of the leftmost element of the first match found;
@@ -608,6 +636,7 @@ return nil if there are no matches.
(if cl-from-end (setq cl-end2 cl-pos) (setq cl-start2 (1+ cl-pos))))
(and (< cl-start2 cl-end2) cl-pos)))))
+;;;###autoload
(defun sort* (cl-seq cl-pred &rest cl-keys)
"Sort the argument SEQ according to PREDICATE.
This is a destructive function; it reuses the storage of SEQ if possible.
@@ -622,6 +651,7 @@ This is a destructive function; it reuses the storage of SEQ if possible.
(funcall cl-pred (funcall cl-key cl-x)
(funcall cl-key cl-y)))))))))
+;;;###autoload
(defun stable-sort (cl-seq cl-pred &rest cl-keys)
"Sort the argument SEQ stably according to PREDICATE.
This is a destructive function; it reuses the storage of SEQ if possible.
@@ -629,6 +659,7 @@ This is a destructive function; it reuses the storage of SEQ if possible.
\n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
(apply 'sort* cl-seq cl-pred cl-keys))
+;;;###autoload
(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
"Destructively merge the two sequences to produce a new sequence.
TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument
@@ -647,6 +678,7 @@ sequences, and PREDICATE is a `less-than' predicate on the elements.
(coerce (nconc (nreverse cl-res) cl-seq1 cl-seq2) cl-type))))
;;; See compiler macro in cl-macs.el
+;;;###autoload
(defun member* (cl-item cl-list &rest cl-keys)
"Find the first occurrence of ITEM in LIST.
Return the sublist of LIST whose car is ITEM.
@@ -661,6 +693,7 @@ Return the sublist of LIST whose car is ITEM.
(member cl-item cl-list)
(memq cl-item cl-list))))
+;;;###autoload
(defun member-if (cl-pred cl-list &rest cl-keys)
"Find the first item satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
@@ -668,6 +701,7 @@ Return the sublist of LIST whose car matches.
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'member* nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun member-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item not satisfying PREDICATE in LIST.
Return the sublist of LIST whose car matches.
@@ -675,6 +709,7 @@ Return the sublist of LIST whose car matches.
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'member* nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun cl-adjoin (cl-item cl-list &rest cl-keys)
(if (cl-parsing-keywords (:key) t
(apply 'member* (cl-check-key cl-item) cl-list cl-keys))
@@ -682,6 +717,7 @@ Return the sublist of LIST whose car matches.
(cons cl-item cl-list)))
;;; See compiler macro in cl-macs.el
+;;;###autoload
(defun assoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose car matches ITEM in LIST.
\nKeywords supported: :test :test-not :key
@@ -697,18 +733,21 @@ Return the sublist of LIST whose car matches.
(assoc cl-item cl-alist)
(assq cl-item cl-alist))))
+;;;###autoload
(defun assoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose car satisfies PREDICATE in LIST.
\nKeywords supported: :key
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'assoc* nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun assoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose car does not satisfy PREDICATE in LIST.
\nKeywords supported: :key
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'assoc* nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun rassoc* (cl-item cl-alist &rest cl-keys)
"Find the first item whose cdr matches ITEM in LIST.
\nKeywords supported: :test :test-not :key
@@ -722,18 +761,21 @@ Return the sublist of LIST whose car matches.
(and cl-alist (car cl-alist)))
(rassq cl-item cl-alist)))
+;;;###autoload
(defun rassoc-if (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr satisfies PREDICATE in LIST.
\nKeywords supported: :key
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'rassoc* nil cl-list :if cl-pred cl-keys))
+;;;###autoload
(defun rassoc-if-not (cl-pred cl-list &rest cl-keys)
"Find the first item whose cdr does not satisfy PREDICATE in LIST.
\nKeywords supported: :key
\n(fn PREDICATE LIST [KEYWORD VALUE]...)"
(apply 'rassoc* nil cl-list :if-not cl-pred cl-keys))
+;;;###autoload
(defun union (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-union operation.
The result list contains all items that appear in either LIST1 or LIST2.
@@ -754,6 +796,7 @@ to avoid corrupting the original LIST1 and LIST2.
(pop cl-list2))
cl-list1)))
+;;;###autoload
(defun nunion (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-union operation.
The result list contains all items that appear in either LIST1 or LIST2.
@@ -764,6 +807,7 @@ whenever possible.
(cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
(t (apply 'union cl-list1 cl-list2 cl-keys))))
+;;;###autoload
(defun intersection (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-intersection operation.
The result list contains all items that appear in both LIST1 and LIST2.
@@ -786,6 +830,7 @@ to avoid corrupting the original LIST1 and LIST2.
(pop cl-list2))
cl-res)))))
+;;;###autoload
(defun nintersection (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-intersection operation.
The result list contains all items that appear in both LIST1 and LIST2.
@@ -795,6 +840,7 @@ whenever possible.
\n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
(and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys)))
+;;;###autoload
(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-difference operation.
The result list contains all items that appear in LIST1 but not LIST2.
@@ -814,6 +860,7 @@ to avoid corrupting the original LIST1 and LIST2.
(pop cl-list1))
cl-res))))
+;;;###autoload
(defun nset-difference (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-difference operation.
The result list contains all items that appear in LIST1 but not LIST2.
@@ -824,6 +871,7 @@ whenever possible.
(if (or (null cl-list1) (null cl-list2)) cl-list1
(apply 'set-difference cl-list1 cl-list2 cl-keys)))
+;;;###autoload
(defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-exclusive-or operation.
The result list contains all items that appear in exactly one of LIST1, LIST2.
@@ -836,6 +884,7 @@ to avoid corrupting the original LIST1 and LIST2.
(t (append (apply 'set-difference cl-list1 cl-list2 cl-keys)
(apply 'set-difference cl-list2 cl-list1 cl-keys)))))
+;;;###autoload
(defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
"Combine LIST1 and LIST2 using a set-exclusive-or operation.
The result list contains all items that appear in exactly one of LIST1, LIST2.
@@ -848,6 +897,7 @@ whenever possible.
(t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys)
(apply 'nset-difference cl-list2 cl-list1 cl-keys)))))
+;;;###autoload
(defun subsetp (cl-list1 cl-list2 &rest cl-keys)
"Return true if LIST1 is a subset of LIST2.
I.e., if every element of LIST1 also appears in LIST2.
@@ -862,6 +912,7 @@ I.e., if every element of LIST1 also appears in LIST2.
(pop cl-list1))
(null cl-list1)))))
+;;;###autoload
(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced by NEW.
@@ -869,6 +920,7 @@ Return a copy of TREE with all matching elements replaced by NEW.
\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
+;;;###autoload
(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
Return a copy of TREE with all non-matching elements replaced by NEW.
@@ -876,6 +928,7 @@ Return a copy of TREE with all non-matching elements replaced by NEW.
\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
+;;;###autoload
(defun nsubst (cl-new cl-old cl-tree &rest cl-keys)
"Substitute NEW for OLD everywhere in TREE (destructively).
Any element of TREE which is `eql' to OLD is changed to NEW (via a call
@@ -884,6 +937,7 @@ to `setcar').
\n(fn NEW OLD TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
+;;;###autoload
(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
@@ -891,6 +945,7 @@ Any element of TREE which matches is changed to NEW (via a call to `setcar').
\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
+;;;###autoload
(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
"Substitute NEW for elements not matching PREDICATE in TREE (destructively).
Any element of TREE which matches is changed to NEW (via a call to `setcar').
@@ -898,6 +953,7 @@ Any element of TREE which matches is changed to NEW (via a call to `setcar').
\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
(apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
+;;;###autoload
(defun sublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (non-destructively).
Return a copy of TREE with all matching elements replaced.
@@ -920,6 +976,7 @@ Return a copy of TREE with all matching elements replaced.
(cons cl-a cl-d)))
cl-tree))))
+;;;###autoload
(defun nsublis (cl-alist cl-tree &rest cl-keys)
"Perform substitutions indicated by ALIST in TREE (destructively).
Any matching element of TREE is changed via a call to `setcar'.
@@ -944,6 +1001,7 @@ Any matching element of TREE is changed via a call to `setcar'.
(progn (setcdr cl-tree (cdr (car cl-p))) (setq cl-tree nil))
(setq cl-tree (cdr cl-tree))))))
+;;;###autoload
(defun tree-equal (cl-x cl-y &rest cl-keys)
"Return t if trees TREE1 and TREE2 have `eql' leaves.
Atoms are compared by `eql'; cons cells are compared recursively.
@@ -961,5 +1019,9 @@ Atoms are compared by `eql'; cons cells are compared recursively.
(run-hooks 'cl-seq-load-hook)
-;;; arch-tag: ec1cc072-9006-4225-b6ba-d6b07ed1710c
+;; Local variables:
+;; generated-autoload-file: "cl-loaddefs.el"
+;; End:
+
+;; arch-tag: ec1cc072-9006-4225-b6ba-d6b07ed1710c
;;; cl-seq.el ends here
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index 89c0721adb..8d609509f1 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -113,8 +113,9 @@ a future Emacs interpreter will be able to use it.")
(defun cl-cannot-unload ()
(error "Cannot unload the feature `cl'"))
-;;; Generalized variables. These macros are defined here so that they
-;;; can safely be used in .emacs files.
+;;; Generalized variables.
+;; These macros are defined here so that they
+;; can safely be used in .emacs files.
(defmacro incf (place &optional x)
"Increment PLACE by X (1 by default).
@@ -185,8 +186,8 @@ an element already on the list.
;;; Control structures.
-;;; These macros are so simple and so often-used that it's better to have
-;;; them all the time than to load them from cl-macs.el.
+;; These macros are so simple and so often-used that it's better to have
+;; them all the time than to load them from cl-macs.el.
(defun cl-map-extents (&rest cl-args)
(apply 'cl-map-overlays cl-args))
@@ -198,9 +199,10 @@ an element already on the list.
(defalias 'cl-block-throw 'throw)
-;;; Multiple values. True multiple values are not supported, or even
-;;; simulated. Instead, multiple-value-bind and friends simply expect
-;;; the target form to return the values as a list.
+;;; Multiple values.
+;; True multiple values are not supported, or even
+;; simulated. Instead, multiple-value-bind and friends simply expect
+;; the target form to return the values as a list.
(defsubst values (&rest values)
"Return multiple values, Common Lisp style.
@@ -321,7 +323,7 @@ always returns nil."
(defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time)))
-;;; The following are actually set by cl-float-limits.
+;; The following are actually set by cl-float-limits.
(defconst most-positive-float nil)
(defconst most-negative-float nil)
(defconst least-positive-float nil)
@@ -585,105 +587,55 @@ If ALIST is non-nil, the new pairs are prepended to it."
;;; Miscellaneous.
-(defvar cl-fake-autoloads nil
- "Non-nil means don't make CL functions autoload.")
-
-;;; Autoload the other portions of the package.
+;; Define data for indentation and edebug.
+(dolist (entry
+ '(((defun* defmacro*) 2)
+ ((function*) nil
+ (&or symbolp ([&optional 'macro] 'lambda (&rest sexp) &rest form)))
+ ((eval-when) 1 (sexp &rest form))
+ ((declare) nil (&rest sexp))
+ ((the) 1 (sexp &rest form))
+ ((case ecase typecase etypecase) 1 (form &rest (sexp &rest form)))
+ ((block return-from) 1 (sexp &rest form))
+ ((return) nil (&optional form))
+ ((do do*) 2 ((&rest &or symbolp (symbolp &optional form form))
+ (form &rest form)
+ &rest form))
+ ((do-symbols) 1 ((symbolp form &optional form form) &rest form))
+ ((do-all-symbols) 1 ((symbolp form &optional form) &rest form))
+ ((psetq setf psetf) nil edebug-setq-form)
+ ((progv) 2 (&rest form))
+ ((flet labels macrolet) 1
+ ((&rest (sexp sexp &rest form)) &rest form))
+ ((symbol-macrolet lexical-let lexical-let*) 1
+ ((&rest &or symbolp (symbolp form)) &rest form))
+ ((multiple-value-bind) 2 ((&rest symbolp) &rest form))
+ ((multiple-value-setq) 1 ((&rest symbolp) &rest form))
+ ((incf decf remf pushnew shiftf rotatef) nil (&rest form))
+ ((letf letf*) 1 ((&rest (&rest form)) &rest form))
+ ((callf destructuring-bind) 2 (sexp form &rest form))
+ ((callf2) 3 (sexp form form &rest form))
+ ((loop) nil (&rest &or symbolp form))
+ ((ignore-errors) 0 (&rest form))))
+ (dolist (func (car entry))
+ (put func 'lisp-indent-function (nth 1 entry))
+ (put func 'lisp-indent-hook (nth 1 entry))
+ (or (get func 'edebug-form-spec)
+ (put func 'edebug-form-spec (nth 2 entry)))))
+
+;; Autoload the other portions of the package.
;; We want to replace the basic versions of dolist, dotimes, declare below.
(fmakunbound 'dolist)
(fmakunbound 'dotimes)
(fmakunbound 'declare)
-(mapcar (function
- (lambda (set)
- (let ((file (if cl-fake-autoloads "<none>" (car set))))
- (mapcar (function
- (lambda (func)
- (autoload func (car set) nil nil (nth 1 set))))
- (cddr set)))))
- '(("cl-extra" nil
- coerce equalp cl-map-keymap maplist mapc mapl mapcan mapcon
- cl-map-keymap cl-map-keymap-recursively cl-map-intervals
- cl-map-overlays cl-set-frame-visible-p cl-float-limits
- gcd lcm isqrt floor* ceiling* truncate* round*
- mod* rem* signum random* make-random-state random-state-p
- subseq concatenate cl-mapcar-many map some every notany
- notevery revappend nreconc list-length tailp copy-tree get* getf
- cl-set-getf cl-do-remf remprop cl-make-hash-table cl-hash-lookup
- cl-gethash cl-puthash cl-remhash cl-clrhash cl-maphash cl-hash-table-p
- cl-hash-table-count cl-progv-before cl-prettyexpand
- cl-macroexpand-all)
- ("cl-seq" nil
- reduce fill replace remove* remove-if remove-if-not
- delete* delete-if delete-if-not remove-duplicates
- delete-duplicates substitute substitute-if substitute-if-not
- nsubstitute nsubstitute-if nsubstitute-if-not find find-if
- find-if-not position position-if position-if-not count count-if
- count-if-not mismatch search sort* stable-sort merge member*
- member-if member-if-not cl-adjoin assoc* assoc-if assoc-if-not
- rassoc* rassoc-if rassoc-if-not union nunion intersection
- nintersection set-difference nset-difference set-exclusive-or
- nset-exclusive-or subsetp subst-if subst-if-not nsubst nsubst-if
- nsubst-if-not sublis nsublis tree-equal)
- ("cl-macs" nil
- gensym gentemp typep cl-do-pop get-setf-method
- cl-struct-setf-expander compiler-macroexpand cl-compile-time-init)
- ("cl-macs" t
- defun* defmacro* function* destructuring-bind eval-when
- load-time-value case ecase typecase etypecase
- block return return-from loop do do* dolist dotimes do-symbols
- do-all-symbols psetq progv flet labels macrolet symbol-macrolet
- lexical-let lexical-let* multiple-value-bind multiple-value-setq
- locally the declare define-setf-method defsetf define-modify-macro
- setf psetf remf shiftf rotatef letf letf* callf callf2 defstruct
- check-type assert ignore-errors define-compiler-macro)))
-
-;;; Define data for indentation and edebug.
-(mapcar (function
- (lambda (entry)
- (mapcar (function
- (lambda (func)
- (put func 'lisp-indent-function (nth 1 entry))
- (put func 'lisp-indent-hook (nth 1 entry))
- (or (get func 'edebug-form-spec)
- (put func 'edebug-form-spec (nth 2 entry)))))
- (car entry))))
- '(((defun* defmacro*) 2)
- ((function*) nil
- (&or symbolp ([&optional 'macro] 'lambda (&rest sexp) &rest form)))
- ((eval-when) 1 (sexp &rest form))
- ((declare) nil (&rest sexp))
- ((the) 1 (sexp &rest form))
- ((case ecase typecase etypecase) 1 (form &rest (sexp &rest form)))
- ((block return-from) 1 (sexp &rest form))
- ((return) nil (&optional form))
- ((do do*) 2 ((&rest &or symbolp (symbolp &optional form form))
- (form &rest form)
- &rest form))
- ((do-symbols) 1 ((symbolp form &optional form form) &rest form))
- ((do-all-symbols) 1 ((symbolp form &optional form) &rest form))
- ((psetq setf psetf) nil edebug-setq-form)
- ((progv) 2 (&rest form))
- ((flet labels macrolet) 1
- ((&rest (sexp sexp &rest form)) &rest form))
- ((symbol-macrolet lexical-let lexical-let*) 1
- ((&rest &or symbolp (symbolp form)) &rest form))
- ((multiple-value-bind) 2 ((&rest symbolp) &rest form))
- ((multiple-value-setq) 1 ((&rest symbolp) &rest form))
- ((incf decf remf pushnew shiftf rotatef) nil (&rest form))
- ((letf letf*) 1 ((&rest (&rest form)) &rest form))
- ((callf destructuring-bind) 2 (sexp form &rest form))
- ((callf2) 3 (sexp form form &rest form))
- ((loop) nil (&rest &or symbolp form))
- ((ignore-errors) 0 (&rest form))))
-
-
-;;; This goes here so that cl-macs can find it if it loads right now.
-(provide 'cl-19) ; usage: (require 'cl-19 "cl")
+(load "cl-loaddefs" nil 'quiet)
+;; This goes here so that cl-macs can find it if it loads right now.
+(provide 'cl-19) ; usage: (require 'cl-19 "cl")
-;;; Things to do after byte-compiler is loaded.
-;;; As a side effect, we cause cl-macs to be loaded when compiling, so
-;;; that the compiler-macros defined there will be present.
+;; Things to do after byte-compiler is loaded.
+;; As a side effect, we cause cl-macs to be loaded when compiling, so
+;; that the compiler-macros defined there will be present.
(defvar cl-hacked-flag nil)
(defun cl-hack-byte-compiler ()
@@ -692,15 +644,15 @@ If ALIST is non-nil, the new pairs are prepended to it."
(setq cl-hacked-flag t) ; Do it first, to prevent recursion.
(cl-compile-time-init)))) ; In cl-macs.el.
-;;; Try it now in case the compiler has already been loaded.
+;; Try it now in case the compiler has already been loaded.
(cl-hack-byte-compiler)
-;;; Also make a hook in case compiler is loaded after this file.
+;; Also make a hook in case compiler is loaded after this file.
(add-hook 'bytecomp-load-hook 'cl-hack-byte-compiler)
-;;; The following ensures that packages which expect the old-style cl.el
-;;; will be happy with this one.
+;; The following ensures that packages which expect the old-style cl.el
+;; will be happy with this one.
(provide 'cl)
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index ed1d01023f..b53ec9c217 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -46,14 +46,22 @@ A value of nil means to search whole buffer."
;; The character classes have the Latin-1 version and the Latin-9
;; version, which is probably enough.
(defcustom copyright-regexp
- "\\([����]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
-\\|[Cc]opyright\\s *:?\\s *[����]\\)\
+ "\\([����]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
+\\|[Cc]opyright\\s *:?\\s *[����]\\)\
\\s *\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
"What your copyright notice looks like.
The second \\( \\) construct must match the years."
:group 'copyright
:type 'regexp)
+(defcustom copyright-names-regexp ""
+ "Regexp matching the names which correspond to the user.
+Only copyright lines where the name matches this regexp will be updated.
+This allows you to avoid adding years to a copyright notice belonging to
+someone else or to a group for which you do not work."
+ :group 'copyright
+ :type 'regexp)
+
(defcustom copyright-years-regexp
"\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
"Match additional copyright notice years.
@@ -82,9 +90,22 @@ When this is `function', only ask when called non-interactively."
(defvar copyright-current-year (substring (current-time-string) -4)
"String representing the current year.")
+(defsubst copyright-limit () ; re-search-forward BOUND
+ (and copyright-limit (+ (point) copyright-limit)))
+
(defun copyright-update-year (replace noquery)
- (when (re-search-forward copyright-regexp
- (if copyright-limit (+ (point) copyright-limit)) t)
+ (when
+ (condition-case err
+ (re-search-forward (concat "\\(" copyright-regexp
+ "\\)\\([ \t]*\n\\)?.*\\(?:"
+ copyright-names-regexp "\\)")
+ (copyright-limit)
+ t)
+ ;; In case the regexp is rejected. This is useful because
+ ;; copyright-update is typically called from before-save-hook where
+ ;; such an error is very inconvenient for the user.
+ (error (message "Can't update copyright: %s" err) nil))
+ (goto-char (match-end 1))
;; If the years are continued onto multiple lined
;; that are marked as comments, skip to the end of the years anyway.
(while (save-excursion
@@ -104,7 +125,7 @@ When this is `function', only ask when called non-interactively."
;; Note that `current-time-string' isn't locale-sensitive.
(setq copyright-current-year (substring (current-time-string) -4))
- (unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
+ (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
(substring copyright-current-year -2))
(if (or noquery
(y-or-n-p (if replace
@@ -164,11 +185,14 @@ interactively."
"\\(the Free Software Foundation;\
either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\
version \\([0-9]+\\), or (at"
- (if copyright-limit (+ (point) copyright-limit)) t)
- (not (string= (match-string 3) copyright-current-gpl-version))
+ (copyright-limit) t)
+ ;; Don't update if the file is already using a more recent
+ ;; version than the "current" one.
+ (< (string-to-number (match-string 3))
+ (string-to-number copyright-current-gpl-version))
(or noquery
- (y-or-n-p (concat "Replace GPL version by "
- copyright-current-gpl-version "? ")))
+ (y-or-n-p (format "Replace GPL version by %s? "
+ copyright-current-gpl-version)))
(progn
(if (match-end 2)
;; Esperanto bilingual comment in two-column.el
@@ -186,8 +210,7 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx."
(interactive)
(widen)
(goto-char (point-min))
- (if (re-search-forward copyright-regexp
- (if copyright-limit (+ (point) copyright-limit)) t)
+ (if (re-search-forward copyright-regexp (copyright-limit) t)
(let ((s (match-beginning 2))
(e (copy-marker (1+ (match-end 2))))
(p (make-marker))
diff --git a/lisp/emacs-lisp/cust-print.el b/lisp/emacs-lisp/cust-print.el
index 54ead36e72..fdfb4f1111 100644
--- a/lisp/emacs-lisp/cust-print.el
+++ b/lisp/emacs-lisp/cust-print.el
@@ -244,14 +244,14 @@ Any pair that has the same PREDICATE is first removed."
;; Save emacs routines.
(if (not (fboundp 'cust-print-original-prin1))
- (mapcar 'cust-print-set-function-cell
- '((cust-print-original-prin1 prin1)
- (cust-print-original-princ princ)
- (cust-print-original-print print)
- (cust-print-original-prin1-to-string prin1-to-string)
- (cust-print-original-format format)
- (cust-print-original-message message)
- (cust-print-original-error error))))
+ (mapc 'cust-print-set-function-cell
+ '((cust-print-original-prin1 prin1)
+ (cust-print-original-princ princ)
+ (cust-print-original-print print)
+ (cust-print-original-prin1-to-string prin1-to-string)
+ (cust-print-original-format format)
+ (cust-print-original-message message)
+ (cust-print-original-error error))))
(defun custom-print-install ()
@@ -259,29 +259,29 @@ Any pair that has the same PREDICATE is first removed."
The Emacs subroutines are saved away, and you can reinstall them
by running `custom-print-uninstall'."
(interactive)
- (mapcar 'cust-print-set-function-cell
- '((prin1 custom-prin1)
- (princ custom-princ)
- (print custom-print)
- (prin1-to-string custom-prin1-to-string)
- (format custom-format)
- (message custom-message)
- (error custom-error)
- ))
+ (mapc 'cust-print-set-function-cell
+ '((prin1 custom-prin1)
+ (princ custom-princ)
+ (print custom-print)
+ (prin1-to-string custom-prin1-to-string)
+ (format custom-format)
+ (message custom-message)
+ (error custom-error)
+ ))
t)
(defun custom-print-uninstall ()
"Reset print functions to their Emacs subroutines."
(interactive)
- (mapcar 'cust-print-set-function-cell
- '((prin1 cust-print-original-prin1)
- (princ cust-print-original-princ)
- (print cust-print-original-print)
- (prin1-to-string cust-print-original-prin1-to-string)
- (format cust-print-original-format)
- (message cust-print-original-message)
- (error cust-print-original-error)
- ))
+ (mapc 'cust-print-set-function-cell
+ '((prin1 cust-print-original-prin1)
+ (princ cust-print-original-princ)
+ (print cust-print-original-print)
+ (prin1-to-string cust-print-original-prin1-to-string)
+ (format cust-print-original-format)
+ (message cust-print-original-message)
+ (error cust-print-original-error)
+ ))
t)
(defalias 'custom-print-funcs-installed-p 'custom-print-installed-p)
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 68b82d5422..acf73d94b3 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -254,11 +254,7 @@ No problems result if this variable is not bound.
,@body
)
;; Run the hooks, if any.
- ;; Make the generated code work in older Emacs versions
- ;; that do not yet have run-mode-hooks.
- (if (fboundp 'run-mode-hooks)
- (run-mode-hooks ',hook)
- (run-hooks ',hook))))))
+ (run-mode-hooks ',hook)))))
;; PUBLIC: find the ultimate class of a derived mode.
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 01378a7f8d..60b29bdb94 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -250,7 +250,7 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler."
(+ indent disassemble-recursive-indent)))
((eq (car-safe (car-safe arg)) 'byte-code)
(insert "(<byte code>...)\n")
- (mapcar ;recurse on list of byte-code objects
+ (mapc ;recurse on list of byte-code objects
'(lambda (obj)
(disassemble-1
obj
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index d9497355fe..da0b76808d 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -458,7 +458,7 @@ ARGS is a list of additional keyword arguments."
(let ((char (car cs))
(syntax (cdr cs)))
(if (sequencep char)
- (mapcar (lambda (c) (modify-syntax-entry c syntax st)) char)
+ (mapc (lambda (c) (modify-syntax-entry c syntax st)) char)
(modify-syntax-entry char syntax st))))
(if parent (set-char-table-parent
st (if (symbolp parent) (symbol-value parent) parent)))
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 030e1bccbd..b802d8acd4 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -152,6 +152,21 @@ A menu item can be a list with the same format as MENU. This is a submenu."
,(if symbol `(defvar ,symbol nil ,doc))
(easy-menu-do-define (quote ,symbol) ,maps ,doc ,menu)))
+(defun easy-menu-binding (menu &optional item-name)
+ "Return a binding suitable to pass to `define-key'.
+This is expected to be bound to a mouse event."
+ ;; Under Emacs this is almost trivial, whereas under XEmacs this may
+ ;; involve defining a function that calls popup-menu.
+ (let ((props (if (symbolp menu)
+ (prog1 (get menu 'menu-prop)
+ (setq menu (symbol-function menu))))))
+ (cons 'menu-item
+ (cons (or item-name
+ (if (keymapp menu)
+ (keymap-prompt menu))
+ "")
+ (cons menu props)))))
+
;;;###autoload
(defun easy-menu-do-define (symbol maps doc menu)
;; We can't do anything that might differ between Emacs dialects in
@@ -173,15 +188,10 @@ A menu item can be a list with the same format as MENU. This is a submenu."
'identity)
(symbol-function ,symbol)))
,symbol)))))
- (mapcar (lambda (map)
- (define-key map (vector 'menu-bar (easy-menu-intern (car menu)))
- (cons 'menu-item
- (cons (car menu)
- (if (not (symbolp keymap))
- (list keymap)
- (cons (symbol-function keymap)
- (get keymap 'menu-prop)))))))
- (if (keymapp maps) (list maps) maps))))
+ (dolist (map (if (keymapp maps) (list maps) maps))
+ (define-key map
+ (vector 'menu-bar (easy-menu-intern (car menu)))
+ (easy-menu-binding keymap (car menu))))))
(defun easy-menu-filter-return (menu &optional name)
"Convert MENU to the right thing to return from a menu filter.
@@ -249,10 +259,6 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
(defvar easy-menu-button-prefix
'((radio . :radio) (toggle . :toggle)))
-(defun easy-menu-do-add-item (menu item &optional before)
- (setq item (easy-menu-convert-item item))
- (easy-menu-define-key menu (easy-menu-intern (car item)) (cdr item) before))
-
(defvar easy-menu-converted-items-table (make-hash-table :test 'equal))
(defun easy-menu-convert-item (item)
@@ -269,7 +275,7 @@ would always fail because the key is `equal' but not `eq'."
(defun easy-menu-convert-item-1 (item)
"Parse an item description and convert it to a menu keymap element.
ITEM defines an item as in `easy-menu-define'."
- (let (name command label prop remove help)
+ (let (name command label prop remove)
(cond
((stringp item) ; An item or separator.
(setq label item))
@@ -536,7 +542,8 @@ earlier by `easy-menu-define' or `easy-menu-create-menu'."
(setq item (symbol-value item))))
;; Item is a keymap, find the prompt string and use as item name.
(setq item (cons (keymap-prompt item) item)))
- (easy-menu-do-add-item map item before)))
+ (setq item (easy-menu-convert-item item))
+ (easy-menu-define-key map (easy-menu-intern (car item)) (cdr item) before)))
(defun easy-menu-item-present-p (map path name)
"In submenu of MAP with path PATH, return non-nil if item NAME is present.
@@ -615,7 +622,8 @@ In some cases we use that to select between the local and global maps."
(catch 'found
(if (and map (symbolp map) (not (keymapp map)))
(setq map (symbol-value map)))
- (let ((maps (if map (list map) (current-active-maps))))
+ (let ((maps (if map (if (keymapp map) (list map) map)
+ (current-active-maps))))
;; Look for PATH in each map.
(unless map (push 'menu-bar path))
(dolist (name path)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 63b2db96fc..01d883d63b 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -369,7 +369,7 @@ Return the result of the last expression in BODY."
;; Otherwise, find a new window, possibly splitting one.
(setq window
(cond
- ((and (windowp window) (edebug-window-live-p window)
+ ((and (edebug-window-live-p window)
(eq (window-buffer window) buffer))
window)
((eq (window-buffer (selected-window)) buffer)
@@ -2739,7 +2739,7 @@ MSG is printed after `::::} '."
;; Unrestore edebug-buffer's window-start, if displayed.
(let ((window (car edebug-window-data)))
- (if (and window (edebug-window-live-p window)
+ (if (and (edebug-window-live-p window)
(eq (window-buffer) edebug-buffer))
(progn
(set-window-start window (cdr edebug-window-data)
@@ -3675,6 +3675,44 @@ Return the result of the last expression."
;;; Printing
+;; Replace printing functions.
+
+;; obsolete names
+(define-obsolete-function-alias 'edebug-install-custom-print-funcs
+ 'edebug-install-custom-print "22.1")
+(define-obsolete-function-alias 'edebug-reset-print-funcs
+ 'edebug-uninstall-custom-print "22.1")
+(define-obsolete-function-alias 'edebug-uninstall-custom-print-funcs
+ 'edebug-uninstall-custom-print "22.1")
+
+(defun edebug-install-custom-print ()
+ "Replace print functions used by Edebug with custom versions."
+ ;; Modifying the custom print functions, or changing print-length,
+ ;; print-level, print-circle, custom-print-list or custom-print-vector
+ ;; have immediate effect.
+ (interactive)
+ (require 'cust-print)
+ (defalias 'edebug-prin1 'custom-prin1)
+ (defalias 'edebug-print 'custom-print)
+ (defalias 'edebug-prin1-to-string 'custom-prin1-to-string)
+ (defalias 'edebug-format 'custom-format)
+ (defalias 'edebug-message 'custom-message)
+ "Installed")
+
+(eval-and-compile
+ (defun edebug-uninstall-custom-print ()
+ "Replace edebug custom print functions with internal versions."
+ (interactive)
+ (defalias 'edebug-prin1 'prin1)
+ (defalias 'edebug-print 'print)
+ (defalias 'edebug-prin1-to-string 'prin1-to-string)
+ (defalias 'edebug-format 'format)
+ (defalias 'edebug-message 'message)
+ "Uninstalled")
+
+ ;; Default print functions are the same as Emacs'.
+ (edebug-uninstall-custom-print))
+
(defun edebug-report-error (edebug-value)
;; Print an error message like command level does.
@@ -3721,12 +3759,6 @@ Return the result of the last expression."
;;; Read, Eval and Print
-(defalias 'edebug-prin1 'prin1)
-(defalias 'edebug-print 'print)
-(defalias 'edebug-prin1-to-string 'prin1-to-string)
-(defalias 'edebug-format 'format)
-(defalias 'edebug-message 'message)
-
(defun edebug-eval-expression (edebug-expr)
"Evaluate an expression in the outside environment.
If interactive, prompt for the expression.
@@ -4389,7 +4421,7 @@ With prefix argument, make it a temporary breakpoint."
(defun byte-compile-resolve-functions (funcs)
"Say it is OK for the named functions to be unresolved."
- (mapcar
+ (mapc
(function
(lambda (func)
(setq byte-compile-unresolved-functions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index f0ae9ddafb..7807fc763a 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -101,6 +101,11 @@ truncated to make more of the arglist or documentation string visible."
enable argument list to fit on one line" truncate-sym-name-if-fit))
:group 'eldoc)
+(defface eldoc-highlight-function-argument
+ '((t (:inherit bold)))
+ "Face used for the argument at point in a function's argument list."
+ :group 'eldoc)
+
;;; No user options below here.
(defvar eldoc-message-commands-table-size 31
@@ -124,8 +129,8 @@ directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.")
(defconst eldoc-last-data (make-vector 3 nil)
"Bookkeeping; elements are as follows:
0 - contains the last symbol read from the buffer.
- 1 - contains the string last displayed in the echo area for that
- symbol, so it can be printed again if necessary without reconsing.
+ 1 - contains the string last displayed in the echo area for variables,
+ or argument string for functions.
2 - 'function if function args, 'variable if variable documentation.")
(defvar eldoc-last-message nil)
@@ -249,37 +254,93 @@ Emacs Lisp mode) that support Eldoc.")
(let* ((current-symbol (eldoc-current-symbol))
(current-fnsym (eldoc-fnsym-in-current-sexp))
(doc (cond
- ((eq current-symbol current-fnsym)
- (or (eldoc-get-fnsym-args-string current-fnsym)
+ ((null current-fnsym)
+ nil)
+ ((eq current-symbol (car current-fnsym))
+ (or (apply 'eldoc-get-fnsym-args-string
+ current-fnsym)
(eldoc-get-var-docstring current-symbol)))
(t
(or (eldoc-get-var-docstring current-symbol)
- (eldoc-get-fnsym-args-string current-fnsym))))))
+ (apply 'eldoc-get-fnsym-args-string
+ current-fnsym))))))
(eldoc-message doc))))
;; This is run from post-command-hook or some idle timer thing,
;; so we need to be careful that errors aren't ignored.
(error (message "eldoc error: %s" err))))
-;; Return a string containing the function parameter list, or 1-line
-;; docstring if function is a subr and no arglist is obtainable from the
-;; docstring or elsewhere.
-(defun eldoc-get-fnsym-args-string (sym)
- (let ((args nil)
- (doc nil))
+(defun eldoc-get-fnsym-args-string (sym &optional index)
+ "Return a string containing the parameter list of the function SYM.
+If SYM is a subr and no arglist is obtainable from the docstring
+or elsewhere, return a 1-line docstring. Calls the functions
+`eldoc-function-argstring-format' and
+`eldoc-highlight-function-argument' to format the result. The
+former calls `eldoc-argument-case'; the latter gives the
+function name `font-lock-function-name-face', and optionally
+highlights argument number INDEX. "
+ (let (args doc)
(cond ((not (and sym (symbolp sym) (fboundp sym))))
- ((and (eq sym (aref eldoc-last-data 0))
- (eq 'function (aref eldoc-last-data 2)))
- (setq doc (aref eldoc-last-data 1)))
+ ((and (eq sym (aref eldoc-last-data 0))
+ (eq 'function (aref eldoc-last-data 2)))
+ (setq doc (aref eldoc-last-data 1)))
((setq doc (help-split-fundoc (documentation sym t) sym))
(setq args (car doc))
+ ;; Remove any enclosing (), since e-function-argstring adds them.
(string-match "\\`[^ )]* ?" args)
- (setq args (concat "(" (substring args (match-end 0)))))
- (t
- (setq args (eldoc-function-argstring sym))))
- (cond (args
- (setq doc (eldoc-docstring-format-sym-doc sym args))
- (eldoc-last-data-store sym doc 'function)))
- doc))
+ (setq args (substring args (match-end 0)))
+ (if (string-match ")\\'" args)
+ (setq args (substring args 0 -1))))
+ (t
+ (setq args (help-function-arglist sym))))
+ (if args
+ ;; Stringify, and store before highlighting, downcasing, etc.
+ ;; FIXME should truncate before storing.
+ (eldoc-last-data-store sym (setq args (eldoc-function-argstring args))
+ 'function)
+ (setq args doc)) ; use stored value
+ ;; Change case, highlight, truncate.
+ (if args
+ (eldoc-highlight-function-argument
+ sym (eldoc-function-argstring-format args) index))))
+
+(defun eldoc-highlight-function-argument (sym args index)
+ "Highlight argument INDEX in ARGS list for function SYM.
+In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
+ (let ((start nil)
+ (end 0)
+ (argument-face 'eldoc-highlight-function-argument))
+ ;; Find the current argument in the argument string. We need to
+ ;; handle `&rest' and informal `...' properly.
+ ;;
+ ;; FIXME: What to do with optional arguments, like in
+ ;; (defun NAME ARGLIST [DOCSTRING] BODY...) case?
+ ;; The problem is there is no robust way to determine if
+ ;; the current argument is indeed a docstring.
+ (while (and index (>= index 1))
+ (if (string-match "[^ ()]+" args end)
+ (progn
+ (setq start (match-beginning 0)
+ end (match-end 0))
+ (let ((argument (match-string 0 args)))
+ (cond ((string= argument "&rest")
+ ;; All the rest arguments are the same.
+ (setq index 1))
+ ((string= argument "&optional"))
+ ((string-match "\\.\\.\\.$" argument)
+ (setq index 0))
+ (t
+ (setq index (1- index))))))
+ (setq end (length args)
+ start (1- end)
+ argument-face 'font-lock-warning-face
+ index 0)))
+ (let ((doc args))
+ (when start
+ (setq doc (copy-sequence args))
+ (add-text-properties start end (list 'face argument-face) doc))
+ (setq doc (eldoc-docstring-format-sym-doc
+ sym doc 'font-lock-function-name-face))
+ doc)))
;; Return a string containing a brief (one-line) documentation string for
;; the variable.
@@ -292,7 +353,8 @@ Emacs Lisp mode) that support Eldoc.")
(let ((doc (documentation-property sym 'variable-documentation t)))
(cond (doc
(setq doc (eldoc-docstring-format-sym-doc
- sym (eldoc-docstring-first-line doc)))
+ sym (eldoc-docstring-first-line doc)
+ 'font-lock-variable-name-face))
(eldoc-last-data-store sym doc 'variable)))
doc)))))
@@ -316,7 +378,7 @@ Emacs Lisp mode) that support Eldoc.")
;; If the entire line cannot fit in the echo area, the symbol name may be
;; truncated or eliminated entirely from the output to make room for the
;; description.
-(defun eldoc-docstring-format-sym-doc (sym doc)
+(defun eldoc-docstring-format-sym-doc (sym doc face)
(save-match-data
(let* ((name (symbol-name sym))
(ea-multi eldoc-echo-area-use-multiline-p)
@@ -328,7 +390,7 @@ Emacs Lisp mode) that support Eldoc.")
(cond ((or (<= strip 0)
(eq ea-multi t)
(and ea-multi (> (length doc) ea-width)))
- (format "%s: %s" sym doc))
+ (format "%s: %s" (propertize name 'face face) doc))
((> (length doc) ea-width)
(substring (format "%s" doc) 0 ea-width))
((>= strip (length name))
@@ -338,27 +400,44 @@ Emacs Lisp mode) that support Eldoc.")
;; than the beginning, since the former is more likely
;; to be unique given package namespace conventions.
(setq name (substring name strip))
- (format "%s: %s" name doc))))))
+ (format "%s: %s" (propertize name 'face face) doc))))))
+;; Return a list of current function name and argument index.
(defun eldoc-fnsym-in-current-sexp ()
- (let ((p (point)))
- (eldoc-beginning-of-sexp)
- (prog1
- ;; Don't do anything if current word is inside a string.
- (if (= (or (char-after (1- (point))) 0) ?\")
- nil
- (eldoc-current-symbol))
- (goto-char p))))
-
+ (save-excursion
+ (let ((argument-index (1- (eldoc-beginning-of-sexp))))
+ ;; If we are at the beginning of function name, this will be -1.
+ (when (< argument-index 0)
+ (setq argument-index 0))
+ ;; Don't do anything if current word is inside a string.
+ (if (= (or (char-after (1- (point))) 0) ?\")
+ nil
+ (list (eldoc-current-symbol) argument-index)))))
+
+;; Move to the beginnig of current sexp. Return the number of nested
+;; sexp the point was over or after.
(defun eldoc-beginning-of-sexp ()
- (let ((parse-sexp-ignore-comments t))
+ (let ((parse-sexp-ignore-comments t)
+ (num-skipped-sexps 0))
(condition-case err
- (while (progn
- (forward-sexp -1)
- (or (= (char-before) ?\")
- (> (point) (point-min)))))
- (error nil))))
+ (progn
+ ;; First account for the case the point is directly over a
+ ;; beginning of a nested sexp.
+ (condition-case err
+ (let ((p (point)))
+ (forward-sexp -1)
+ (forward-sexp 1)
+ (when (< (point) p)
+ (setq num-skipped-sexps 1)))
+ (error))
+ (while
+ (let ((p (point)))
+ (forward-sexp -1)
+ (when (< (point) p)
+ (setq num-skipped-sexps (1+ num-skipped-sexps))))))
+ (error))
+ num-skipped-sexps))
;; returns nil unless current word is an interned symbol.
(defun eldoc-current-symbol ()
@@ -377,28 +456,31 @@ Emacs Lisp mode) that support Eldoc.")
(error (setq defn nil))))
defn))
-(defun eldoc-function-argstring (fn)
- (eldoc-function-argstring-format (help-function-arglist fn)))
-
-(defun eldoc-function-argstring-format (arglist)
- (cond ((not (listp arglist))
- (setq arglist nil))
- ((symbolp (car arglist))
- (setq arglist
- (mapcar (function (lambda (s)
- (if (memq s '(&optional &rest))
- (symbol-name s)
- (funcall eldoc-argument-case
- (symbol-name s)))))
- arglist)))
- ((stringp (car arglist))
- (setq arglist
- (mapcar (function (lambda (s)
- (if (member s '("&optional" "&rest"))
- s
- (funcall eldoc-argument-case s))))
- arglist))))
- (concat "(" (mapconcat 'identity arglist " ") ")"))
+(defun eldoc-function-argstring (arglist)
+ "Return ARGLIST as a string enclosed by ().
+ARGLIST is either a string, or a list of strings or symbols."
+ (cond ((stringp arglist))
+ ((not (listp arglist))
+ (setq arglist nil))
+ ((symbolp (car arglist))
+ (setq arglist
+ (mapconcat (lambda (s) (symbol-name s))
+ arglist " ")))
+ ((stringp (car arglist))
+ (setq arglist
+ (mapconcat (lambda (s) s)
+ arglist " "))))
+ (if arglist
+ (format "(%s)" arglist)))
+
+(defun eldoc-function-argstring-format (argstring)
+ "Apply `eldoc-argument-case' to each word in ARGSTRING.
+The words \"&rest\", \"&optional\" are returned unchanged."
+ (mapconcat (lambda (s)
+ (if (member s '("&optional" "&rest"))
+ s
+ (funcall eldoc-argument-case s)))
+ (split-string argstring "[][ ()]+" t) " "))
;; When point is in a sexp, the function args are not reprinted in the echo
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index f9bff30029..0501fbf171 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -218,7 +218,7 @@ This environment can be passed to `macroexpand'."
(buffer-file-name)
(buffer-name))))
(elint-display-log)
- (mapcar 'elint-top-form (elint-update-env))
+ (mapc 'elint-top-form (elint-update-env))
;; Tell the user we're finished. This is terribly klugy: we set
;; elint-top-form-logged so elint-log-message doesn't print the
@@ -542,11 +542,11 @@ CODE can be a lambda expression, a macro, or byte-compiled code."
(defun elint-check-defun-form (form env)
"Lint a defun/defmacro/lambda FORM in ENV."
(setq form (if (eq (car form) 'lambda) (cdr form) (cdr (cdr form))))
- (mapcar (function (lambda (p)
- (or (memq p '(&optional &rest))
- (setq env (elint-env-add-var env p)))
- ))
- (car form))
+ (mapc (function (lambda (p)
+ (or (memq p '(&optional &rest))
+ (setq env (elint-env-add-var env p)))
+ ))
+ (car form))
(elint-forms (cdr form) env))
(defun elint-check-let-form (form env)
@@ -566,21 +566,21 @@ CODE can be a lambda expression, a macro, or byte-compiled code."
;; Add variables to environment, and check the init values
(let ((newenv env))
- (mapcar (function (lambda (s)
- (cond
- ((symbolp s)
- (setq newenv (elint-env-add-var newenv s)))
- ((and (consp s) (<= (length s) 2))
- (elint-form (car (cdr s))
- (if (eq (car form) 'let)
- env
- newenv))
- (setq newenv
- (elint-env-add-var newenv (car s))))
- (t (elint-error
- "Malformed `let' declaration: %s" s))
- )))
- varlist)
+ (mapc (function (lambda (s)
+ (cond
+ ((symbolp s)
+ (setq newenv (elint-env-add-var newenv s)))
+ ((and (consp s) (<= (length s) 2))
+ (elint-form (car (cdr s))
+ (if (eq (car form) 'let)
+ env
+ newenv))
+ (setq newenv
+ (elint-env-add-var newenv (car s))))
+ (t (elint-error
+ "Malformed `let' declaration: %s" s))
+ )))
+ varlist)
;; Lint the body forms
(elint-forms (cdr (cdr form)) newenv)
@@ -665,18 +665,18 @@ CODE can be a lambda expression, a macro, or byte-compiled code."
errlist)
(while errforms
(setq errlist (car (car errforms)))
- (mapcar (function (lambda (s)
- (or (get s 'error-conditions)
- (get s 'error-message)
- (elint-warning
- "Not an error symbol in error handler: %s" s))))
- (cond
- ((symbolp errlist) (list errlist))
- ((listp errlist) errlist)
- (t (elint-error "Bad error list in error handler: %s"
- errlist)
- nil))
- )
+ (mapc (function (lambda (s)
+ (or (get s 'error-conditions)
+ (get s 'error-message)
+ (elint-warning
+ "Not an error symbol in error handler: %s" s))))
+ (cond
+ ((symbolp errlist) (list errlist))
+ ((listp errlist) errlist)
+ (t (elint-error "Bad error list in error handler: %s"
+ errlist)
+ nil))
+ )
(elint-forms (cdr (car errforms)) newenv)
(setq errforms (cdr errforms))
)))
@@ -767,11 +767,11 @@ Insert HEADER followed by a blank line if non-nil."
(defun elint-initialize ()
"Initialize elint."
(interactive)
- (mapcar (function (lambda (x)
- (or (not (symbolp (car x)))
- (eq (cdr x) 'unknown)
- (put (car x) 'elint-args (cdr x)))))
- (elint-find-builtin-args))
+ (mapc (function (lambda (x)
+ (or (not (symbolp (car x)))
+ (eq (cdr x) 'unknown)
+ (put (car x) 'elint-args (cdr x)))))
+ (elint-find-builtin-args))
(mapcar (function (lambda (x)
(put (car x) 'elint-args (cdr x))))
elint-unknown-builtin-args))
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index ed09599f4d..ade2a23608 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -615,7 +615,7 @@ displayed."
;; buffer
(if elp-sort-by-function
(setq resvec (sort resvec elp-sort-by-function)))
- (mapcar 'elp-output-result resvec))
+ (mapc 'elp-output-result resvec))
;; now pop up results buffer
(set-buffer curbuf)
(pop-to-buffer resultsbuf)
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index d57e7ca765..805507adb4 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -205,7 +205,7 @@ See the file generic-x.el for some examples of `define-generic-mode'."
(setq font-lock-defaults '(generic-font-lock-keywords))
;; Call a list of functions
- (mapcar 'funcall function-list)
+ (mapc 'funcall function-list)
(run-mode-hooks mode-hook)))
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 846e3fce55..7eeefd349a 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -56,6 +56,8 @@
(modify-syntax-entry i "_ " table)
(setq i (1+ i)))
(modify-syntax-entry ?\s " " table)
+ ;; Non-break space acts as whitespace.
+ (modify-syntax-entry ?\x8a0 " " table)
(modify-syntax-entry ?\t " " table)
(modify-syntax-entry ?\f " " table)
(modify-syntax-entry ?\n "> " table)
@@ -259,7 +261,6 @@
(defvar lisp-mode-shared-map
(let ((map (make-sparse-keymap)))
- (define-key map "\t" 'lisp-indent-line)
(define-key map "\e\C-q" 'indent-sexp)
(define-key map "\177" 'backward-delete-char-untabify)
;; This gets in the way when viewing a Lisp file in view-mode. As
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 21175a03b4..a5cefff399 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -103,6 +103,7 @@ Also add the value to the front of the list in the variable `values'."
(interactive
(list (read-from-minibuffer "Eval: " nil read-expression-map t
'read-expression-history)))
+ (message "Evaluating...")
(setq values (cons (eval expression) values))
(let* ((old-show-function temp-buffer-show-function)
;; Use this function to display the buffer.
@@ -126,13 +127,16 @@ Also add the value to the front of the list in the variable `values'."
(progn
(select-window window)
(run-hooks 'temp-buffer-show-hook))
- (select-window old-selected)))
+ (select-window old-selected)
+ (message "Evaluating...done. \
+See buffer *Pp Eval Output*.")))
(message "%s" (buffer-substring (point-min) (point)))
))))))
(with-output-to-temp-buffer "*Pp Eval Output*"
(pp (car values))
(with-current-buffer standard-output
(emacs-lisp-mode)
+ (setq buffer-read-only nil)
(set (make-local-variable 'font-lock-verbose) nil)))))
;;;###autoload
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index d859066c45..a0004be239 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -515,7 +515,7 @@ optional fourth argument FORCE is non-nil."
"Delete all RE Builder overlays in the `reb-target-buffer' buffer."
(if (buffer-live-p reb-target-buffer)
(with-current-buffer reb-target-buffer
- (mapcar 'delete-overlay reb-overlays)
+ (mapc 'delete-overlay reb-overlays)
(setq reb-overlays nil))))
(defun reb-assert-buffer-in-window ()
diff --git a/lisp/emacs-lisp/regi.el b/lisp/emacs-lisp/regi.el
index ed3f846bf0..267d773143 100644
--- a/lisp/emacs-lisp/regi.el
+++ b/lisp/emacs-lisp/regi.el
@@ -166,7 +166,7 @@ useful information:
;; lets find the special tags and remove them from the working
;; frame. note that only the last special tag is used.
- (mapcar
+ (mapc
(function
(lambda (entry)
(let ((pred (car entry))
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 45a1e9c8d1..f46aea8540 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -120,7 +120,7 @@
(| . or) ; SRE
(not-newline . ".")
(nonl . not-newline) ; SRE
- (anything . ".\\|\n")
+ (anything . "\\(?:.\\|\n\\)")
(any . (rx-any 1 nil rx-check-any)) ; inconsistent with SRE
(in . any)
(char . any) ; sregex
@@ -679,7 +679,7 @@ CHAR
`not-newline', `nonl'
matches any character except a newline.
- .
+
`anything'
matches any character
diff --git a/lisp/emacs-lisp/sregex.el b/lisp/emacs-lisp/sregex.el
index 901156cefc..d4deb0f910 100644
--- a/lisp/emacs-lisp/sregex.el
+++ b/lisp/emacs-lisp/sregex.el
@@ -565,7 +565,7 @@ has one of the following forms:
(let ((chars (make-bool-vector 256 nil))) ; Yeah, right!
(dolist (arg args)
(cond ((integerp arg) (aset chars arg t))
- ((stringp arg) (mapcar (lambda (c) (aset chars c t)) arg))
+ ((stringp arg) (mapc (lambda (c) (aset chars c t)) arg))
((consp arg)
(let ((start (car arg))
(end (cdr arg)))