emacs/lisp/emacs-lisp/cl-extra.el

1118 lines
39 KiB
EmacsLisp
Raw Normal View History

;;; cl-extra.el --- Common Lisp features, part 2 -*- lexical-binding: t -*-
1993-07-30 20:15:09 +00:00
;; Copyright (C) 1993, 2000-2025 Free Software Foundation, Inc.
1993-07-30 20:15:09 +00:00
;; Author: Dave Gillespie <daveg@synaptics.com>
;; Keywords: extensions
;; Package: emacs
1993-07-30 20:15:09 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
1993-07-30 20:15:09 +00:00
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
1993-07-30 20:15:09 +00:00
;; 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. If not, see <https://www.gnu.org/licenses/>.
1993-07-30 20:15:09 +00:00
1994-06-17 20:04:22 +00:00
;;; Commentary:
1993-07-30 20:15:09 +00:00
;; These are extensions to Emacs Lisp that provide a degree of
;; Common Lisp compatibility, beyond what is already built-in
;; in Emacs Lisp.
;;
;; This package was written by Dave Gillespie; it is a complete
;; rewrite of Cesar Quiroz's original cl.el package of December 1986.
;;
;; Bug reports, comments, and suggestions are welcome!
;; This file contains portions of the Common Lisp extensions
;; package which are autoloaded since they are relatively obscure.
1994-06-17 20:04:22 +00:00
;;; Code:
1993-07-30 20:15:09 +00:00
(require 'cl-lib)
(require 'seq)
1993-07-30 20:15:09 +00:00
;;; Type coercion.
;;;###autoload
(defun cl-coerce (x type)
1993-07-30 20:15:09 +00:00
"Coerce OBJECT to type TYPE.
TYPE is a Common Lisp type specifier.
\n(fn OBJECT TYPE)"
1993-07-30 20:15:09 +00:00
(cond ((eq type 'list) (if (listp x) x (append x nil)))
((eq type 'vector) (if (vectorp x) x (vconcat x)))
((eq type 'bool-vector)
(if (bool-vector-p x) x (apply #'bool-vector (cl-coerce x 'list))))
1993-07-30 20:15:09 +00:00
((eq type 'string) (if (stringp x) x (concat x)))
((eq type 'array) (if (arrayp x) x (vconcat x)))
((and (eq type 'character) (stringp x) (= (length x) 1)) (aref x 0))
((and (eq type 'character) (symbolp x))
(cl-coerce (symbol-name x) type))
1993-07-30 20:15:09 +00:00
((eq type 'float) (float x))
((cl-typep x type) x)
1993-07-30 20:15:09 +00:00
(t (error "Can't coerce %s to type %s" x type))))
;;; Predicates.
;;;###autoload
(defun cl-equalp (x y)
2005-05-16 15:32:09 +00:00
"Return t if two Lisp objects have similar structures and contents.
1993-07-30 20:15:09 +00:00
This is like `equal', except that it accepts numerically equal
numbers of different types (float vs. integer), and also compares
strings case-insensitively."
(declare (side-effect-free error-free))
1993-07-30 20:15:09 +00:00
(cond ((eq x y) t)
((stringp x)
string-equal-ignore-case: new function * lisp/cedet/semantic/complete.el (semantic-collector-calculate-completions): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add `string-equal-ignore-case'. * lisp/emacs-lisp/cl-extra.el (cl-equalp): Use `string-equal-ignore-case'. * lisp/emacs-lisp/shadow.el (load-path-shadows-find): Likewise. * lisp/emacs-lisp/shortdoc.el (string): Add `string-equal-ignore-case'. * lisp/files.el (file-truename): Use `string-equal-ignore-case'. (file-relative-name): Likewise. * lisp/gnus/gnus-art.el (article-hide-boring-headers): Use `string-equal-ignore-case' instead of `gnus-string-equal'. * lisp/gnus/gnus-util.el (gnus-string-equal): Remove, use `string-equal-ignore-case' instead. * lisp/international/mule-cmds.el (describe-language-environment): Use `string-equal-ignore-case'. (locale-charset-match-p): Likewise. * lisp/man.el (Man-softhyphen-to-minus): Use `string-prefix-p'. * lisp/minibuffer.el (completion--string-equal-p): Remove, use `string-equal-ignore-case' instead. (completion--twq-all): Use `string-equal-ignore-case'. (completion--do-completion): Likewise. * lisp/net/browse-url.el (browse-url-default-windows-browser): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/org/ob-core.el (org-babel-results-keyword): Use `string-equal-ignore-case' instead of explicit `compare-strings'. (org-babel-insert-result): Likewise. * lisp/org/org-compat.el (string-equal-ignore-case): Define unless defined already. (org-mode-flyspell-verify): Use `string-equal-ignore-case'. * lisp/org/org-lint.el (org-lint-duplicate-custom-id): Likewise. * lisp/org/ox.el (org-export-resolve-radio-link): Use `string-equal-ignore-case' and `string-clean-whitespace'. * lisp/progmodes/flymake-proc.el (flymake-proc--check-patch-master-file-buffer): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/progmodes/idlwave.el (idlwave-class-or-superclass-with-tag): Use `string-equal-ignore-case' instead of explicit `compare-strings'. * lisp/subr.el (member-ignore-case): Use `string-equal-ignore-case'. (string-equal-ignore-case): Compare strings ignoring case. * lisp/textmodes/bibtex.el (bibtex-string=): Remove. (bibtex-format-entry, bibtex-font-lock-url, bibtex-autofill-entry) (bibtex-print-help-message, bibtex-validate, bibtex-validate-globally) (bibtex-clean-entry, bibtex-completion-at-point-function, (bibtex-url): Use `string-equal-ignore-case' instead of `bibtex-string='. * lisp/textmodes/sgml-mode.el (sgml-get-context): Use `string-equal-ignore-case' instead of explicit `compare-strings'. (sgml-calculate-indent): Likewise * test/lisp/subr-tests.el (string-comparison-test): Add tests for `string-equal-ignore-case'.
2022-07-26 13:47:03 -04:00
(and (stringp y) (string-equal-ignore-case x y)))
1993-07-30 20:15:09 +00:00
((numberp x)
(and (numberp y) (= x y)))
((consp x)
(while (and (consp x) (consp y) (cl-equalp (car x) (car y)))
(setq x (cdr x) y (cdr y)))
(and (not (consp x)) (cl-equalp x y)))
1993-07-30 20:15:09 +00:00
((vectorp x)
(and (vectorp y) (= (length x) (length y))
(let ((i (length x)))
(while (and (>= (setq i (1- i)) 0)
(cl-equalp (aref x i) (aref y i))))
1993-07-30 20:15:09 +00:00
(< i 0))))
(t (equal x y))))
;;; Control structures.
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl--mapcar-many (func seqs &optional acc)
(if (cdr (cdr seqs))
(let* ((res nil)
(n (apply #'min (mapcar #'length seqs)))
(i 0)
(args (copy-sequence seqs))
p1 p2)
(setq seqs (copy-sequence seqs))
(while (< i n)
(setq p1 seqs p2 args)
(while p1
(setcar p2
(if (consp (car p1))
(prog1 (car (car p1))
(setcar p1 (cdr (car p1))))
(aref (car p1) i)))
(setq p1 (cdr p1) p2 (cdr p2)))
(if acc
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(push (apply func args) res)
(apply func args))
(setq i (1+ i)))
(and acc (nreverse res)))
(let ((res nil)
(x (car seqs))
(y (nth 1 seqs)))
(let ((n (min (length x) (length y)))
(i -1))
(while (< (setq i (1+ i)) n)
(let ((val (funcall func
(if (consp x) (pop x) (aref x i))
(if (consp y) (pop y) (aref y i)))))
(when acc
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(push val res)))))
(and acc (nreverse res)))))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defsubst cl-map (type func seq &rest rest)
"Map a FUNCTION across one or more SEQUENCEs, returning a sequence.
TYPE is the sequence type to return.
\n(fn TYPE FUNCTION SEQUENCE...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(let ((res (apply 'cl-mapcar func seq rest)))
(and type (cl-coerce res type))))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-maplist (func list &rest rest)
"Map FUNCTION to each sublist of LIST or LISTs.
Like `cl-mapcar', except applies to lists and their cdr's rather than to
the elements themselves.
\n(fn FUNCTION LIST...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if rest
(let ((res nil)
(args (cons list (copy-sequence rest)))
p)
(while (not (memq nil args))
(push (apply func args) res)
(setq p args)
(while p (setcar p (cdr (pop p)))))
(nreverse res))
(let ((res nil))
(while list
(push (funcall func list) res)
(setq list (cdr list)))
(nreverse res))))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-mapc (func seq &rest rest)
"Like `cl-mapcar', but does not accumulate values returned by the function.
\n(fn FUNCTION SEQUENCE...)"
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if rest
(if (or (cdr rest) (nlistp seq) (nlistp (car rest)))
(progn
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(cl--mapcar-many func (cons seq rest))
seq)
(let ((x seq) (y (car rest)))
(while (and x y)
(funcall func (pop x) (pop y)))
seq))
(mapc func seq)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-mapl (func list &rest rest)
"Like `cl-maplist', but does not accumulate values returned by the function.
\n(fn FUNCTION LIST...)"
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if rest
(let ((args (cons list (copy-sequence rest)))
p)
(while (not (memq nil args))
(apply func args)
(setq p args)
(while p (setcar p (cdr (pop p))))))
(let ((p list))
(while p (funcall func p) (setq p (cdr p)))))
list)
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-mapcan (func seq &rest rest)
"Like `cl-mapcar', but nconc's together the values returned by the function.
\n(fn FUNCTION SEQUENCE...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if rest
(apply #'nconc (apply #'cl-mapcar func seq rest))
(mapcan func seq)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-mapcon (func list &rest rest)
"Like `cl-maplist', but nconc's together the values returned by the function.
\n(fn FUNCTION LIST...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(apply #'nconc (apply #'cl-maplist func list rest)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-some (pred seq &rest rest)
"Say whether PREDICATE is true for any element in the SEQ sequences.
More specifically, the return value of this function will be the
same as the first return value of PREDICATE where PREDICATE has a
non-nil value.
\n(fn PREDICATE SEQ...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if (or rest (nlistp seq))
1993-07-30 20:15:09 +00:00
(catch 'cl-some
(apply #'cl-map nil
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(lambda (&rest x)
(let ((res (apply pred x)))
(if res (throw 'cl-some res))))
seq rest) nil)
(let ((x nil))
(while (and seq (not (setq x (funcall pred (pop seq))))))
x)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl-every (pred seq &rest rest)
"Return true if PREDICATE is true of every element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(if (or rest (nlistp seq))
1993-07-30 20:15:09 +00:00
(catch 'cl-every
(apply #'cl-map nil
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(lambda (&rest x)
(or (apply pred x) (throw 'cl-every nil)))
seq rest) t)
(while (and seq (funcall pred (car seq)))
(setq seq (cdr seq)))
(null seq)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defsubst cl-notany (pred seq &rest rest)
"Return true if PREDICATE is false of every element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(not (apply #'cl-some pred seq rest)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defsubst cl-notevery (pred seq &rest rest)
"Return true if PREDICATE is false of some element of SEQ or SEQs.
\n(fn PREDICATE SEQ...)"
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(not (apply #'cl-every pred seq rest)))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl--map-keymap-recursively (func-rec map &optional base)
(or base
(setq base (copy-sequence [0])))
(map-keymap
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(lambda (key bind)
(aset base (1- (length base)) key)
(if (keymapp bind)
(cl--map-keymap-recursively
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
func-rec bind
(vconcat base (list 0)))
(funcall func-rec base bind)))
map))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl--map-intervals (func &optional what prop start end)
(or what (setq what (current-buffer)))
(if (bufferp what)
(let (mark mark2 (next t) next2)
(with-current-buffer what
(setq mark (copy-marker (or start (point-min))))
(setq mark2 (and end (copy-marker end))))
(while (and next (or (not mark2) (< mark mark2)))
(setq next (if prop (next-single-property-change
mark prop what)
(next-property-change mark what))
next2 (or next (with-current-buffer what
(point-max))))
(funcall func (prog1 (marker-position mark)
(set-marker mark next2))
(if mark2 (min next2 mark2) next2)))
(set-marker mark nil) (if mark2 (set-marker mark2 nil)))
(or start (setq start 0))
(or end (setq end (length what)))
(while (< start end)
(let ((next (or (if prop (next-single-property-change
start prop what)
(next-property-change start what))
end)))
(funcall func start (min next end))
(setq start next)))))
1993-07-30 20:15:09 +00:00
;;;###autoload
Clean up 'cl-' prefixes for local variables The 'cl-' prefixes used for let-bound variables and argument names is a holdover from the dynbind days. They are no longer necessary, and make the code hard to read. This was partially cleaned up in the past; let's finish the job now. * lisp/emacs-lisp/cl-extra.el (cl--mapcar-many, cl-map, cl-maplist) (cl-mapc, cl-mapl, cl-mapcan, cl-mapcon, cl-some, cl-every, cl-notany) (cl-notevery, cl--map-keymap-recursively, cl--map-intervals) (cl--map-overlays): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst) (cl--do-subst): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-fill, cl-replace, cl-remove) (cl-remove-if, cl-remove-if-not, cl-delete, cl-delete-if) (cl-delete-if-not, cl-remove-duplicates, cl-delete-duplicates) (cl--delete-duplicates, cl-substitute, cl-substitute-if) (cl-substitute-if-not, cl-nsubstitute, cl-nsubstitute-if) (cl-nsubstitute-if-not, cl-find, cl-find-if, cl-find-if-not) (cl-position, cl--position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl--adjoin, cl-assoc, cl-assoc-if, cl-assoc-if-not) (cl-rassoc, cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion) (cl-intersection, cl-nintersection, cl-set-difference) (cl-nset-difference, cl-set-exclusive-or, cl-nset-exclusive-or) (cl-subsetp, cl-subst-if, cl-subst-if-not, cl-nsubst, cl-nsubst-if) (cl-nsubst-if-not, cl-sublis, cl--sublis-rec, cl-nsublis) (cl--nsublis-rec, cl-tree-equal, cl--tree-equal-rec): Clean up 'cl-' prefixes for let-bound variables and arguments.
2025-03-05 02:42:10 +01:00
(defun cl--map-overlays (func &optional buffer start end arg)
(or buffer (setq buffer (current-buffer)))
(let (ovl)
(with-current-buffer buffer
(setq ovl (overlay-lists))
(if start (setq start (copy-marker start)))
(if end (setq end (copy-marker end))))
(setq ovl (nconc (car ovl) (cdr ovl)))
(while (and ovl
(or (not (overlay-start (car ovl)))
(and end (>= (overlay-start (car ovl)) end))
(and start (<= (overlay-end (car ovl)) start))
(not (funcall func (car ovl) arg))))
(setq ovl (cdr ovl)))
(if start (set-marker start nil))
(if end (set-marker end nil))))
1993-07-30 20:15:09 +00:00
Provide generalized variables in core Elisp. * lisp/emacs-lisp/gv.el: New file. * lisp/subr.el (push, pop): Extend to generalized variables. * lisp/loadup.el (macroexp): Unload if preloaded and uncompiled. * lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove. * lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter, gv-define-simple-setter, and gv-define-expander. Remove setf-methods defined in gv. Rename cl-setf -> setf. (cl-setf, cl-do-pop, cl-get-setf-method): Remove. (cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf) (cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el. (cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with gv-letplace. (cl-defstruct): Don't define setf-method any more. * lisp/emacs-lisp/cl.el (flet): Don't autoload. (cl--letf, letf, cl--letf*, letf*, cl--gv-adapt) (define-setf-expander, defsetf, define-modify-macro) (cl-struct-setf-expander): Move from cl-lib.el. * lisp/emacs-lisp/syntax.el: * lisp/emacs-lisp/ewoc.el: * lisp/emacs-lisp/smie.el: * lisp/emacs-lisp/cconv.el: * lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push. (timer--time): Use gv-define-simple-setter. * lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let² to avoid coding-system problems in subr.el. Adjust all users. (macroexp--maxsize, macroexp-small-p): New functions. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf. * lisp/scroll-bar.el (scroll-bar-mode): * lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode) (normal-erase-is-backspace-mode): Don't use the `eq' place. * lisp/winner.el (winner-configuration, winner-make-point-alist) (winner-set-conf, winner-get-point, winner-set): Don't abuse letf. * lisp/files.el (locate-file-completion-table): Avoid list*. Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
;;; Support for `setf'.
;;;###autoload
(defun cl--set-frame-visible-p (frame val)
1993-07-30 20:15:09 +00:00
(cond ((null val) (make-frame-invisible frame))
((eq val 'icon) (iconify-frame frame))
(t (make-frame-visible frame)))
val)
;;; Numbers.
;;;###autoload
(defun cl-gcd (&rest args)
1993-07-30 20:15:09 +00:00
"Return the greatest common divisor of the arguments."
(declare (side-effect-free t))
(let ((a (or (pop args) 0)))
(dolist (b args)
(while (/= b 0)
(setq b (% a (setq a b)))))
(abs a)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-lcm (&rest args)
1993-07-30 20:15:09 +00:00
"Return the least common multiple of the arguments."
(declare (side-effect-free t))
1993-07-30 20:15:09 +00:00
(if (memq 0 args)
0
(let ((a (or (pop args) 1)))
(dolist (b args)
(setq a (* (/ a (cl-gcd a b)) b)))
(abs a))))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-isqrt (x)
"Return the integer square root of the (integer) argument X."
(declare (side-effect-free t))
(if (and (integerp x) (> x 0))
(let ((g (ash 2 (/ (logb x) 2)))
1993-07-30 20:15:09 +00:00
g2)
(while (< (setq g2 (/ (+ g (/ x g)) 2)) g)
1993-07-30 20:15:09 +00:00
(setq g g2))
g)
(if (eq x 0) 0 (signal 'arith-error nil))))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-floor (x &optional y)
1993-07-30 20:15:09 +00:00
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."
(declare (side-effect-free t))
(let ((q (floor x y)))
(list q (- x (if y (* y q) q)))))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-ceiling (x &optional y)
1993-07-30 20:15:09 +00:00
"Return a list of the ceiling of X and the fractional part of X.
With two arguments, return ceiling and remainder of their quotient."
(declare (side-effect-free t))
(let ((res (cl-floor x y)))
1993-07-30 20:15:09 +00:00
(if (= (car (cdr res)) 0) res
(list (1+ (car res)) (- (car (cdr res)) (or y 1))))))
;;;###autoload
(defun cl-truncate (x &optional y)
1993-07-30 20:15:09 +00:00
"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."
(declare (side-effect-free t))
1993-07-30 20:15:09 +00:00
(if (eq (>= x 0) (or (null y) (>= y 0)))
(cl-floor x y) (cl-ceiling x y)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-round (x &optional y)
1993-07-30 20:15:09 +00:00
"Return a list of X rounded to the nearest integer and the remainder.
With two arguments, return rounding and remainder of their quotient."
(declare (side-effect-free t))
1993-07-30 20:15:09 +00:00
(if y
(if (and (integerp x) (integerp y))
(let* ((hy (/ y 2))
(res (cl-floor (+ x hy) y)))
1993-07-30 20:15:09 +00:00
(if (and (= (car (cdr res)) 0)
(= (+ hy hy) y)
(oddp (car res)))
1993-07-30 20:15:09 +00:00
(list (1- (car res)) hy)
(list (car res) (- (car (cdr res)) hy))))
(let ((q (round (/ x y))))
(list q (- x (* q y)))))
(if (integerp x) (list x 0)
(let ((q (round x)))
(list q (- x q))))))
;;;###autoload
(defun cl-mod (x y)
1993-07-30 20:15:09 +00:00
"The remainder of X divided by Y, with the same sign as Y."
(declare (side-effect-free t))
(nth 1 (cl-floor x y)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-rem (x y)
1993-07-30 20:15:09 +00:00
"The remainder of X divided by Y, with the same sign as X."
(declare (side-effect-free t))
(nth 1 (cl-truncate x y)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-signum (x)
"Return 1 if X is positive, -1 if negative, 0 if zero."
(declare (side-effect-free t))
(cond ((> x 0) 1) ((< x 0) -1) (t 0)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(cl-defun cl-parse-integer (string &key start end radix junk-allowed)
"Parse integer from the substring of STRING from START to END.
STRING may be surrounded by whitespace chars (chars with syntax ` ').
Other non-digit chars are considered junk.
RADIX is an integer between 2 and 36, the default is 10. Signal
an error if the substring between START and END cannot be parsed
as an integer unless JUNK-ALLOWED is non-nil."
(declare (side-effect-free t))
(cl-check-type string string)
(let* ((start (or start 0))
(len (length string))
(end (or end len))
(radix (or radix 10)))
(or (<= start end len)
(error "Bad interval: [%d, %d)" start end))
(cl-flet ((skip-whitespace ()
(while (and (< start end)
(= 32 (char-syntax (aref string start))))
(setq start (1+ start)))))
(skip-whitespace)
(let ((sign (cl-case (and (< start end) (aref string start))
Prefer incf to cl-incf in emacs-lisp/*.el * lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args): * lisp/emacs-lisp/bindat.el (bindat--type): * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): * lisp/emacs-lisp/chart.el (chart-file-count): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer, cl--print-table): * lisp/emacs-lisp/cl-generic.el (cl--defmethod-doc-pos): * lisp/emacs-lisp/cl-indent.el (common-lisp-loop-part-indentation) (common-lisp-indent-function-1, lisp-indent-defmethod): * lisp/emacs-lisp/cl-lib.el (cl--set-substring): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): * lisp/emacs-lisp/cl-print.el (cl-print--cons-tail) (cl-print--vector-contents, cl-print--struct-contents) (cl-print--string-props): * lisp/emacs-lisp/cl-seq.el (cl-substitute): * lisp/emacs-lisp/comp-cstr.el (comp--range-union) (comp--range-intersection): * lisp/emacs-lisp/comp.el (comp-vec-append, comp--gen-counter) (comp--op-case, comp--limplify-lap-inst, comp--limplify-block) (comp--limplify-function, comp--maybe-add-vmvar, comp--fwprop*): * lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip): * lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/emacs-lisp/ert-x.el (ert-kill-all-test-buffers): * lisp/emacs-lisp/ert.el (ert--stats-set-test-and-result) (ert-write-junit-test-summary-report): * lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist) (memory-report--object-size-1): * lisp/emacs-lisp/oclosure.el (oclosure--index-table) (oclosure--define-functions): * lisp/emacs-lisp/package.el (package-menu--perform-transaction): * lisp/emacs-lisp/smie.el (smie-set-prec2tab, smie-prec2->grammar) (smie-config--guess, smie-config--guess-1): * lisp/emacs-lisp/syntax.el (syntax-propertize-rules) (syntax-ppss--update-stats): * lisp/emacs-lisp/track-changes.el (track-changes--after): Prefer incf to cl-incf.
2025-02-23 00:13:21 +01:00
(?+ (incf start) +1)
(?- (incf start) -1)
(t +1)))
digit sum)
(while (and (< start end)
(setq digit (cl-digit-char-p (aref string start) radix)))
(setq sum (+ (* (or sum 0) radix) digit)
start (1+ start)))
(skip-whitespace)
(cond ((and junk-allowed (null sum)) sum)
(junk-allowed (* sign sum))
((or (/= start end) (null sum))
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(error "Not an integer string: `%s'" string))
(t (* sign sum)))))))
1993-07-30 20:15:09 +00:00
;; Random numbers.
(defun cl--random-time ()
"Return high-precision timestamp from `time-convert'.
For example, suitable for use as seed by `cl-make-random-state'."
(car (time-convert nil t)))
;;;###autoload (autoload 'cl-random-state-p "cl-extra")
;;;###autoload (function-put 'cl-random-state-p 'side-effect-free 'error-free)
(cl-defstruct (cl--random-state
(:copier nil)
(:predicate cl-random-state-p)
(:constructor nil)
(:constructor cl--make-random-state (vec)))
(i -1) (j 30) vec)
(defvar cl--random-state (cl--make-random-state (cl--random-time)))
;;;###autoload
(defun cl-random (lim &optional state)
"Return a pseudo-random nonnegative number less than LIM, an integer or float.
1993-07-30 20:15:09 +00:00
Optional second arg STATE is a random-state object."
(or state (setq state cl--random-state))
1993-07-30 20:15:09 +00:00
;; Inspired by "ran3" from Numerical Recipes. Additive congruential method.
(let ((vec (cl--random-state-vec state)))
1993-07-30 20:15:09 +00:00
(if (integerp vec)
(let ((i 0) (j (- 1357335 (abs (% vec 1357333)))) (k 1))
(setf (cl--random-state-vec state)
(setq vec (make-vector 55 nil)))
1993-07-30 20:15:09 +00:00
(aset vec 0 j)
(while (> (setq i (% (+ i 21) 55)) 0)
(aset vec i (setq j (prog1 k (setq k (- j k))))))
(while (< (setq i (1+ i)) 200) (cl-random 2 state))))
(let* ((i (cl-callf (lambda (x) (% (1+ x) 55)) (cl--random-state-i state)))
(j (cl-callf (lambda (x) (% (1+ x) 55)) (cl--random-state-j state)))
(n (aset vec i (logand 8388607 (- (aref vec i) (aref vec j))))))
1993-07-30 20:15:09 +00:00
(if (integerp lim)
(if (<= lim 512) (% n lim)
Audit use of lsh and fix glitches I audited use of lsh in the Lisp source code, and fixed the glitches that I found. While I was at it, I replaced uses of lsh with ash when either will do. Replacement is OK when either argument is known to be nonnegative, or when only the low-order bits of the result matter, and is a (minor) win since ash is a bit more solid than lsh nowadays, and is a bit faster. * lisp/calc/calc-ext.el (math-check-fixnum): Prefer most-positive-fixnum to (lsh -1 -1). * lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width, prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1 32)) (Bug#32485#11). * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Tighten sanity-check for bytecode overflow, by checking that the result of (ash pc -8) is nonnegative. Formerly this check was not needed since lsh was used and the number overflowed differently. * lisp/net/dns.el (dns-write): Fix some obvious sign typos in shift counts. Evidently this part of the code has never been exercised. * lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright): * lisp/term/common-win.el (x-setup-function-keys): Simplify. * admin/unidata/unidata-gen.el, admin/unidata/uvs.el: * doc/lispref/keymaps.texi, doc/lispref/syntax.texi: * doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19: * lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el: * lisp/calc/calc-ext.el, lisp/calc/calc-math.el: * lisp/cedet/semantic/wisent/comp.el, lisp/composite.el: * lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el: * lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el: * lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el: * lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el: * lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el: * lisp/international/ccl.el, lisp/international/fontset.el: * lisp/international/mule-cmds.el, lisp/international/mule.el: * lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el: * lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el: * lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el: * lisp/net/tramp.el, lisp/obsolete/levents.el: * lisp/obsolete/pgg-parse.el, lisp/org/org.el: * lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el: * lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el: * lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el: * lisp/tar-mode.el, lisp/term/common-win.el: * lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el: * lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el: Prefer ash to lsh when either will do.
2018-08-21 13:44:03 -07:00
(if (> lim 8388607) (setq n (+ (ash n 9) (cl-random 512 state))))
1993-07-30 20:15:09 +00:00
(let ((mask 1023))
(while (< mask (1- lim)) (setq mask (1+ (+ mask mask))))
(if (< (setq n (logand n mask)) lim) n (cl-random lim state))))
1993-07-30 20:15:09 +00:00
(* (/ n '8388608e0) lim)))))
;;;###autoload
(defun cl-make-random-state (&optional state)
"Return a copy of random-state STATE, or of the internal state if omitted.
1993-07-30 20:15:09 +00:00
If STATE is t, return a new state object seeded from the time of day."
(unless state (setq state cl--random-state))
(if (cl-random-state-p state)
(copy-sequence state)
(cl--make-random-state (if (integerp state) state (cl--random-time)))))
1993-07-30 20:15:09 +00:00
;; Implementation limits.
(defun cl--finite-do (func a b)
(condition-case _
1993-07-30 20:15:09 +00:00
(let ((res (funcall func a b))) ; check for IEEE infinity
(and (numberp res) (/= res (/ res 2)) res))
(arith-error nil)))
;;;###autoload
1993-07-30 20:15:09 +00:00
(defun cl-float-limits ()
"Initialize the Common Lisp floating-point parameters.
This sets the values of: `cl-most-positive-float', `cl-most-negative-float',
`cl-least-positive-float', `cl-least-negative-float', `cl-float-epsilon',
`cl-float-negative-epsilon', `cl-least-positive-normalized-float', and
`cl-least-negative-normalized-float'."
(or cl-most-positive-float (not (numberp '2e1))
1993-07-30 20:15:09 +00:00
(let ((x '2e0) y z)
;; Find maximum exponent (first two loops are optimizations)
(while (cl--finite-do '* x x) (setq x (* x x)))
(while (cl--finite-do '* x (/ x 2)) (setq x (* x (/ x 2))))
(while (cl--finite-do '+ x x) (setq x (+ x x)))
1993-07-30 20:15:09 +00:00
(setq z x y (/ x 2))
;; Now cl-fill in 1's in the mantissa.
(while (and (cl--finite-do '+ x y) (/= (+ x y) x))
1993-07-30 20:15:09 +00:00
(setq x (+ x y) y (/ y 2)))
(setq cl-most-positive-float x
cl-most-negative-float (- x))
1993-07-30 20:15:09 +00:00
;; Divide down until mantissa starts rounding.
(setq x (/ x z) y (/ 16 z) x (* x y))
(while (condition-case _ (and (= x (* (/ x 2) 2)) (> (/ y 2) 0))
1993-07-30 20:15:09 +00:00
(arith-error nil))
(setq x (/ x 2) y (/ y 2)))
(setq cl-least-positive-normalized-float y
cl-least-negative-normalized-float (- y))
1993-07-30 20:15:09 +00:00
;; Divide down until value underflows to zero.
(setq x (/ z) y x)
(while (condition-case _ (> (/ x 2) 0) (arith-error nil))
1993-07-30 20:15:09 +00:00
(setq x (/ x 2)))
(setq cl-least-positive-float x
cl-least-negative-float (- x))
1993-07-30 20:15:09 +00:00
(setq x '1e0)
(while (/= (+ '1e0 x) '1e0) (setq x (/ x 2)))
(setq cl-float-epsilon (* x 2))
1993-07-30 20:15:09 +00:00
(setq x '1e0)
(while (/= (- '1e0 x) '1e0) (setq x (/ x 2)))
(setq cl-float-negative-epsilon (* x 2))))
1993-07-30 20:15:09 +00:00
nil)
;;; Sequence functions.
;;;###autoload
(defun cl-subseq (seq start &optional end)
1993-07-30 20:15:09 +00:00
"Return the subsequence of SEQ from START to END.
If END is omitted, it defaults to the length of the sequence.
If START or END is negative, it counts from the end.
Signal an error if START or END are outside of the sequence (i.e
too large if positive or too small if negative)."
2025-02-13 18:40:07 +01:00
(declare (side-effect-free t)
(gv-setter
(lambda (new)
(macroexp-let2 nil new new
`(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end)
,new)))))
(seq-subseq seq start end))
1993-07-30 20:15:09 +00:00
2022-12-12 08:50:21 +01:00
;;; This isn't a defalias because autoloading defaliases doesn't work
;;; very well.
;;;###autoload
(defun cl-concatenate (type &rest sequences)
"Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
\n(fn TYPE SEQUENCE...)"
(apply #'seq-concatenate type sequences))
1993-07-30 20:15:09 +00:00
;;; List functions.
;;;###autoload
(defsubst cl-revappend (x y)
1993-07-30 20:15:09 +00:00
"Equivalent to (append (reverse X) Y)."
(declare (side-effect-free t))
1993-07-30 20:15:09 +00:00
(nconc (reverse x) y))
;;;###autoload
(defsubst cl-nreconc (x y)
1993-07-30 20:15:09 +00:00
"Equivalent to (nconc (nreverse X) Y)."
Inline important-return-value declarations in cl-lib.el These declarations are now properly added to 'cl-lib.el' itself, or to 'cl-loaddefs.el'. This means that they will now correctly show up immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el' is pulled in by an autoload. C.f. Bug#76247. I did not considered worth reproducing everywhere the list saying which functions among the below belong to these two categories: 1. Functions that are side-effect-free except for the behavior of functions passed as argument. 2. Functions that mutate and return a list. AFAIU, this is not actionable with our current byte-compiler, i.e. we can't add any extra declarations based on it. However, if the list should be needed at some point, for example due to improvements in the compiler, this commit will be where to find it. In the worst case, and with more work, it's also deducible from the source code itself. * lisp/emacs-lisp/cl-macs.el: Move important-return-value declarations from here... * lisp/emacs-lisp/cl-extra.el (cl-map, cl-maplist, cl-mapcan) (cl-mapcon, cl-some, cl-every, cl-notany, cl-notevery, cl-nreconc): * lisp/emacs-lisp/cl-lib.el (cl-mapcar, cl-adjoin, cl-subst): * lisp/emacs-lisp/cl-seq.el (cl-reduce, cl-remove, cl-remove-if) (cl-remove-if-not, cl-delete, cl-delete-if, cl-delete-if-not) (cl-remove-duplicates, cl-delete-duplicates, cl-substitute) (cl-substitute-if, cl-substitute-if-not, cl-nsubstitute) (cl-nsubstitute-if, cl-nsubstitute-if-not, cl-find, cl-find-if) (cl-find-if-not, cl-position, cl-position-if, cl-position-if-not) (cl-count, cl-count-if, cl-count-if-not, cl-mismatch, cl-search) (cl-sort, cl-stable-sort, cl-merge, cl-member, cl-member-if) (cl-member-if-not, cl-assoc, cl-assoc-if, cl-assoc-if-not, cl-rassoc) (cl-rassoc-if, cl-rassoc-if-not, cl-union, cl-nunion, cl-intersection) (cl-nintersection, cl-set-difference, cl-nset-difference) (cl-set-exclusive-or, cl-nset-exclusive-or, cl-subsetp, cl-subst-if) (cl-subst-if-not, cl-nsubst, cl-nsubst-if, cl-nsubst-if-not, cl-sublis) (cl-nsublis, cl-tree-equal): ...to have them inline here.
2025-02-14 22:46:07 +01:00
(declare (important-return-value t))
1993-07-30 20:15:09 +00:00
(nconc (nreverse x) y))
;;;###autoload
(defun cl-list-length (x)
"Return the length of list X. Return nil if list is circular."
(declare (side-effect-free t))
(cl-check-type x list)
(condition-case nil
(length x)
(circular-list)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-tailp (sublist list)
1993-07-30 20:15:09 +00:00
"Return true if SUBLIST is a tail of LIST."
(while (and (consp list) (not (eq sublist list)))
(setq list (cdr list)))
(if (numberp sublist) (equal sublist list) (eq sublist list)))
;;; Property lists.
;;;###autoload
(defun cl-get (sym tag &optional def)
"Return the value of SYMBOL's PROPNAME property, or DEFAULT if none.
\n(fn SYMBOL PROPNAME &optional DEFAULT)"
(declare (side-effect-free t)
(compiler-macro cl--compiler-macro-get)
(gv-setter (lambda (store) (ignore def) `(put ,sym ,tag ,store))))
(cl-getf (symbol-plist sym) tag def))
(autoload 'cl--compiler-macro-get "cl-macs")
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl-getf (plist tag &optional def)
1993-07-30 20:15:09 +00:00
"Search PROPLIST for property PROPNAME; return its value or DEFAULT.
PROPLIST is a list of the sort returned by `symbol-plist'.
\n(fn PROPLIST PROPNAME &optional DEFAULT)"
(declare (side-effect-free t)
(gv-expander
(lambda (do)
(gv-letplace (getter setter) plist
(macroexp-let2* nil ((k tag) (d def))
(funcall do `(cl-getf ,getter ,k ,d)
(lambda (v)
(macroexp-let2 nil val v
`(progn
,(funcall setter
`(cl--set-getf ,getter ,k ,val))
,val)))))))))
Audit some plist uses with new predicate argument * doc/lispref/lists.texi (Plist Access): Improve description of default predicate. * lisp/emacs-lisp/cl-extra.el (cl-getf, cl--set-getf): Assume plist-member always returns a cons. * lisp/emacs-lisp/gv.el (plist-get): Support new optional predicate argument (bug#47425#91). * lisp/emacs-lisp/map.el: Bump minor version. (map--dispatch): Remove now that bug#58563 is fixed. Break two remaining uses out into corresponding cl-defmethods. (map--plist-p): Add docstring. (map--plist-has-predicate, map--plist-member-1, map--plist-member) (map--plist-put-1, map--plist-put): New definitions for supporting predicate argument backward compatibly. (map-elt): Fix generalized variable getter under a predicate (bug#58531). Use predicate when given a plist. (map-put): Avoid gratuitous warnings when called without the hidden predicate argument. Improve obsoletion message. (map-put!): Use predicate when given a plist. (map-contains-key): Ditto. Declare forgotten advertised-calling-convention (bug#58531#19). (map--put): Group definition in file together with that of map-put!. * lisp/files-x.el (connection-local-normalize-criteria): Simplify using mapcan + plist-get. * lisp/net/eudc.el (eudc--plist-member): New convenience function. (eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Use it instead of open-coding plist-member. * src/fns.c (Fplist_get, plist_get, Fplist_put, plist_put): Pass the plist element as the first argument to the predicate, for consistency with assoc + alist-get. (Fplist_member, plist_member): Move from widget to plist section. Open-code the EQ case in plist_member, and call it from Fplist_member in that case, rather than the other way around. * test/lisp/apropos-tests.el (apropos-tests-format-plist): Avoid polluting obarray. * test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): Extend test with generalized variables, degenerate plists, and improper lists. * test/lisp/emacs-lisp/gv-tests.el: Byte-compile file; in the meantime bug#24402 seems to have been fixed or worked around. (gv-setter-edebug): Inhibit printing messages. (gv-plist-get): Avoid modifying constant literals. Also test with a predicate argument. * test/lisp/emacs-lisp/map-tests.el (with-maps-do): Simplify docstring. (test-map-elt-testfn): Rename... (test-map-elt-testfn-alist): ...to this. Also test with a predicate argument. (test-map-elt-testfn-plist, test-map-elt-gv, test-map-elt-signature) (test-map-put!-plist, test-map-put!-signature) (test-map-contains-key-signature, test-map-plist-member) (test-map-plist-put): New tests. (test-map-contains-key-testfn): Also test with a predicate argument. (test-map-setf-alist-overwrite-key, test-map-setf-plist-insert-key) (test-map-setf-plist-overwrite-key): Avoid modifying constant literals. (test-hash-table-setf-insert-key) (test-hash-table-setf-overwrite-key): Fix indentation. (test-setf-map-with-function): Make test more precise. * test/lisp/net/eudc-tests.el: New file. * test/lisp/subr-tests.el (test-plistp): Extend test with circular list. * test/src/fns-tests.el (test-cycle-equal, test-cycle-nconc): Move from plist section to circular list section. (plist-put/odd-number-of-elements): Avoid modifying constant literals. (plist-member/improper-list): Simplify. (test-plist): Move to plist section. Also test with a predicate argument.
2022-08-20 16:32:33 +03:00
(let ((val-tail (cdr (plist-member plist tag))))
(if val-tail (car val-tail) def)))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl--set-getf (plist tag val)
Audit some plist uses with new predicate argument * doc/lispref/lists.texi (Plist Access): Improve description of default predicate. * lisp/emacs-lisp/cl-extra.el (cl-getf, cl--set-getf): Assume plist-member always returns a cons. * lisp/emacs-lisp/gv.el (plist-get): Support new optional predicate argument (bug#47425#91). * lisp/emacs-lisp/map.el: Bump minor version. (map--dispatch): Remove now that bug#58563 is fixed. Break two remaining uses out into corresponding cl-defmethods. (map--plist-p): Add docstring. (map--plist-has-predicate, map--plist-member-1, map--plist-member) (map--plist-put-1, map--plist-put): New definitions for supporting predicate argument backward compatibly. (map-elt): Fix generalized variable getter under a predicate (bug#58531). Use predicate when given a plist. (map-put): Avoid gratuitous warnings when called without the hidden predicate argument. Improve obsoletion message. (map-put!): Use predicate when given a plist. (map-contains-key): Ditto. Declare forgotten advertised-calling-convention (bug#58531#19). (map--put): Group definition in file together with that of map-put!. * lisp/files-x.el (connection-local-normalize-criteria): Simplify using mapcan + plist-get. * lisp/net/eudc.el (eudc--plist-member): New convenience function. (eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Use it instead of open-coding plist-member. * src/fns.c (Fplist_get, plist_get, Fplist_put, plist_put): Pass the plist element as the first argument to the predicate, for consistency with assoc + alist-get. (Fplist_member, plist_member): Move from widget to plist section. Open-code the EQ case in plist_member, and call it from Fplist_member in that case, rather than the other way around. * test/lisp/apropos-tests.el (apropos-tests-format-plist): Avoid polluting obarray. * test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): Extend test with generalized variables, degenerate plists, and improper lists. * test/lisp/emacs-lisp/gv-tests.el: Byte-compile file; in the meantime bug#24402 seems to have been fixed or worked around. (gv-setter-edebug): Inhibit printing messages. (gv-plist-get): Avoid modifying constant literals. Also test with a predicate argument. * test/lisp/emacs-lisp/map-tests.el (with-maps-do): Simplify docstring. (test-map-elt-testfn): Rename... (test-map-elt-testfn-alist): ...to this. Also test with a predicate argument. (test-map-elt-testfn-plist, test-map-elt-gv, test-map-elt-signature) (test-map-put!-plist, test-map-put!-signature) (test-map-contains-key-signature, test-map-plist-member) (test-map-plist-put): New tests. (test-map-contains-key-testfn): Also test with a predicate argument. (test-map-setf-alist-overwrite-key, test-map-setf-plist-insert-key) (test-map-setf-plist-overwrite-key): Avoid modifying constant literals. (test-hash-table-setf-insert-key) (test-hash-table-setf-overwrite-key): Fix indentation. (test-setf-map-with-function): Make test more precise. * test/lisp/net/eudc-tests.el: New file. * test/lisp/subr-tests.el (test-plistp): Extend test with circular list. * test/src/fns-tests.el (test-cycle-equal, test-cycle-nconc): Move from plist section to circular list section. (plist-put/odd-number-of-elements): Avoid modifying constant literals. (plist-member/improper-list): Simplify. (test-plist): Move to plist section. Also test with a predicate argument.
2022-08-20 16:32:33 +03:00
(let ((val-tail (cdr (plist-member plist tag))))
(if val-tail (progn (setcar val-tail val) plist)
(cl-list* tag val plist))))
1993-07-30 20:15:09 +00:00
;;;###autoload
(defun cl--do-remf (plist tag)
1993-07-30 20:15:09 +00:00
(let ((p (cdr plist)))
;; Can't use `plist-member' here because it goes to the cons-cell
;; of TAG and we need the one before.
1993-07-30 20:15:09 +00:00
(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 (symbol propname)
"Remove from SYMBOL's plist the property PROPNAME and its value."
(let ((plist (symbol-plist symbol)))
(if (and plist (eq propname (car plist)))
(progn (setplist symbol (cdr (cdr plist))) t)
(cl--do-remf plist propname))))
1993-07-30 20:15:09 +00:00
;;; Streams.
;;;###autoload
(defun cl-fresh-line (&optional stream)
"Output a newline unless already at the beginning of a line."
(terpri stream 'ensure))
1993-07-30 20:15:09 +00:00
;;; Some debugging aids.
(defun cl-prettyprint (form)
"Insert a pretty-printed rendition of a Lisp FORM in current buffer."
(let ((pt (point)) last)
(insert "\n" (prin1-to-string form) "\n")
(setq last (point))
(goto-char (1+ pt))
(while (search-forward "(quote " last t)
(delete-char -7)
1993-07-30 20:15:09 +00:00
(insert "'")
(forward-sexp)
(delete-char 1))
(goto-char (1+ pt))
(cl--do-prettyprint)))
1993-07-30 20:15:09 +00:00
(defun cl--do-prettyprint ()
1993-07-30 20:15:09 +00:00
(skip-chars-forward " ")
(if (looking-at "(")
(let ((skip (or (looking-at "((") (looking-at "(prog")
(looking-at "(unwind-protect ")
(looking-at "(function (")
(looking-at "(cl--block-wrapper ")))
1993-07-30 20:15:09 +00:00
(two (or (looking-at "(defun ") (looking-at "(defmacro ")))
(let (or (looking-at "(let\\*? ") (looking-at "(while ")))
(set (looking-at "(p?set[qf] ")))
(if (or skip let
(progn
(forward-sexp)
(and (>= (current-column) 78) (progn (backward-sexp) t))))
(let ((nl t))
(forward-char 1)
(cl--do-prettyprint)
(or skip (looking-at ")") (cl--do-prettyprint))
(or (not two) (looking-at ")") (cl--do-prettyprint))
1993-07-30 20:15:09 +00:00
(while (not (looking-at ")"))
(if set (setq nl (not nl)))
(if nl (insert "\n"))
(lisp-indent-line)
(cl--do-prettyprint))
1993-07-30 20:15:09 +00:00
(forward-char 1))))
(forward-sexp)))
;;;###autoload
(defun cl-prettyexpand (form &optional _full)
"Expand macros in FORM and insert the pretty-printed result."
(declare (advertised-calling-convention (form) "27.1"))
1993-07-30 20:15:09 +00:00
(message "Expanding...")
(setq form (macroexpand-all form))
(message "Formatting...")
(prog1
(cl-prettyprint form)
(message "")))
1993-07-30 20:15:09 +00:00
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;;; Integration into the online help system.
(eval-when-compile (require 'cl-macs)) ;Explicitly, for cl--find-class.
(require 'help-mode)
(defconst cl--typedef-regexp
(concat "(" (regexp-opt '("defclass" "defstruct" "cl-defstruct"
"cl-deftype" "deftype"))
"[ \t\r\n]+%s[ \t\r\n]+"))
(with-eval-after-load 'find-func
(defvar find-function-regexp-alist)
(add-to-list 'find-function-regexp-alist
Replace insignificant backquotes Replace most insignificant occurrences of '`' with a straight quote, sharp quote or nothing. This includes backquotes in 'pcase' patterns. * admin/admin.el: * lisp/apropos.el: * lisp/arc-mode.el: * lisp/auth-source.el: * lisp/avoid.el: * lisp/bindings.el: * lisp/bs.el: * lisp/calculator.el: * lisp/calendar/todo-mode.el: * lisp/cedet/semantic.el: * lisp/cedet/semantic/analyze/debug.el: * lisp/cedet/semantic/bovine.el: * lisp/cedet/semantic/dep.el: * lisp/cedet/semantic/grammar.el: * lisp/cedet/semantic/wisent/comp.el: * lisp/cedet/semantic/wisent/grammar.el: * lisp/cedet/srecode/mode.el: * lisp/cus-edit.el: * lisp/doc-view.el: * lisp/elec-pair.el: * lisp/electric.el: * lisp/emacs-lisp/autoload.el: * lisp/emacs-lisp/benchmark.el: * lisp/emacs-lisp/byte-opt.el: * lisp/emacs-lisp/bytecomp.el: * lisp/emacs-lisp/cconv.el: * lisp/emacs-lisp/cl-extra.el: * lisp/emacs-lisp/cl-generic.el: * lisp/emacs-lisp/cl-macs.el: * lisp/emacs-lisp/copyright.el: * lisp/emacs-lisp/debug.el: * lisp/emacs-lisp/eieio-compat.el: * lisp/emacs-lisp/ert.el: * lisp/emacs-lisp/generator.el: * lisp/emacs-lisp/inline.el: * lisp/emacs-lisp/macroexp.el: * lisp/emacs-lisp/map.el: * lisp/emacs-lisp/package-x.el: * lisp/emacs-lisp/package.el: * lisp/emacs-lisp/radix-tree.el: * lisp/emacs-lisp/smie.el: * lisp/epa.el: * lisp/erc/erc-dcc.el: * lisp/erc/erc-track.el: * lisp/erc/erc.el: * lisp/eshell/em-ls.el: * lisp/eshell/esh-cmd.el: * lisp/files.el: * lisp/filesets.el: * lisp/font-lock.el: * lisp/frameset.el: * lisp/gnus/gnus-agent.el: * lisp/gnus/gnus-art.el: * lisp/gnus/gnus-cite.el: * lisp/gnus/gnus-group.el: * lisp/gnus/gnus-msg.el: * lisp/gnus/gnus-salt.el: * lisp/gnus/gnus-srvr.el: * lisp/gnus/gnus-sum.el: * lisp/gnus/gnus-topic.el: * lisp/gnus/gnus-util.el: * lisp/gnus/gnus.el: * lisp/gnus/message.el: * lisp/gnus/mm-util.el: * lisp/gnus/mml.el: * lisp/gnus/nnheader.el: * lisp/gnus/nnimap.el: * lisp/gnus/nnmairix.el: * lisp/gnus/spam.el: * lisp/hexl.el: * lisp/hi-lock.el: * lisp/ibuf-ext.el: * lisp/ibuffer.el: * lisp/ido.el: * lisp/info.el: * lisp/international/mule-cmds.el: * lisp/international/mule-util.el: * lisp/json.el: * lisp/jsonrpc.el: * lisp/language/cyrillic.el: * lisp/language/european.el: * lisp/language/georgian.el: * lisp/language/tibetan.el: * lisp/language/utf-8-lang.el: * lisp/language/vietnamese.el: * lisp/ldefs-boot.el: * lisp/mail/mail-extr.el: * lisp/man.el: * lisp/menu-bar.el: * lisp/mh-e/mh-acros.el: * lisp/mh-e/mh-folder.el: * lisp/mh-e/mh-mime.el: * lisp/mh-e/mh-show.el: * lisp/mh-e/mh-speed.el: * lisp/minibuffer.el: * lisp/mpc.el: * lisp/net/ange-ftp.el: * lisp/net/hmac-def.el: * lisp/net/newst-backend.el: * lisp/net/quickurl.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-compat.el: * lisp/notifications.el: * lisp/obsolete/pgg-parse.el: * lisp/obsolete/vc-arch.el: * lisp/obsolete/xesam.el: * lisp/org/ob-C.el: * lisp/org/ob-core.el: * lisp/org/ob-exp.el: * lisp/org/ob-groovy.el: * lisp/org/ob-haskell.el: * lisp/org/ob-io.el: * lisp/org/ob-lisp.el: * lisp/org/ob-lob.el: * lisp/org/ob-lua.el: * lisp/org/ob-octave.el: * lisp/org/ob-perl.el: * lisp/org/ob-python.el: * lisp/org/ob-ref.el: * lisp/org/ob-ruby.el: * lisp/org/ob-sql.el: * lisp/org/org-agenda.el: * lisp/org/org-capture.el: * lisp/org/org-clock.el: * lisp/org/org-colview.el: * lisp/org/org-duration.el: * lisp/org/org-element.el: * lisp/org/org-entities.el: * lisp/org/org-gnus.el: * lisp/org/org-indent.el: * lisp/org/org-info.el: * lisp/org/org-inlinetask.el: * lisp/org/org-lint.el: * lisp/org/org-list.el: * lisp/org/org-mouse.el: * lisp/org/org-plot.el: * lisp/org/org-src.el: * lisp/org/org-table.el: * lisp/org/org.el: * lisp/org/ox-ascii.el: * lisp/org/ox-html.el: * lisp/org/ox-latex.el: * lisp/org/ox-man.el: * lisp/org/ox-md.el: * lisp/org/ox-org.el: * lisp/org/ox-publish.el: * lisp/org/ox-texinfo.el: * lisp/org/ox.el: * lisp/play/bubbles.el: * lisp/play/gamegrid.el: * lisp/progmodes/autoconf.el: * lisp/progmodes/cc-defs.el: * lisp/progmodes/cc-engine.el: * lisp/progmodes/cc-fonts.el: * lisp/progmodes/cc-langs.el: * lisp/progmodes/cperl-mode.el: * lisp/progmodes/ebrowse.el: * lisp/progmodes/elisp-mode.el: * lisp/progmodes/flymake-cc.el: * lisp/progmodes/flymake.el: * lisp/progmodes/fortran.el: * lisp/progmodes/grep.el: * lisp/progmodes/gud.el: * lisp/progmodes/idlwave.el: * lisp/progmodes/js.el: * lisp/progmodes/m4-mode.el: * lisp/progmodes/make-mode.el: * lisp/progmodes/mixal-mode.el: * lisp/progmodes/modula2.el: * lisp/progmodes/octave.el: * lisp/progmodes/opascal.el: * lisp/progmodes/prolog.el: * lisp/progmodes/ps-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/ruby-mode.el: * lisp/progmodes/sh-script.el: * lisp/progmodes/sql.el: * lisp/progmodes/verilog-mode.el: * lisp/ps-mule.el: * lisp/rtree.el: * lisp/ruler-mode.el: * lisp/ses.el: * lisp/simple.el: * lisp/startup.el: * lisp/subr.el: * lisp/term/ns-win.el: * lisp/textmodes/bibtex.el: * lisp/textmodes/conf-mode.el: * lisp/textmodes/css-mode.el: * lisp/textmodes/refill.el: * lisp/textmodes/sgml-mode.el: * lisp/textmodes/tex-mode.el: * lisp/tutorial.el: * lisp/url/url-dav.el: * lisp/url/url-gw.el: * lisp/url/url-http.el: * lisp/url/url-methods.el: * lisp/url/url-privacy.el: * lisp/vc/cvs-status.el: * lisp/vc/diff-mode.el: * lisp/vc/ediff-init.el: * lisp/vc/ediff-ptch.el: * lisp/vc/log-edit.el: * lisp/vc/log-view.el: * lisp/vc/pcvs-info.el: * lisp/vc/pcvs.el: * lisp/vc/smerge-mode.el: * lisp/vc/vc-git.el: * lisp/vc/vc-hg.el: * lisp/vc/vc-mtn.el: * lisp/vc/vc-rcs.el: * lisp/whitespace.el: * lisp/window.el: * test/lisp/electric-tests.el: * test/lisp/emacs-lisp/cl-lib-tests.el: * test/lisp/emacs-lisp/ert-tests.el: * test/lisp/epg-tests.el: * test/lisp/jsonrpc-tests.el: * test/src/data-tests.el: * test/src/json-tests.el: Replace most insignificant backquotes.
2018-11-05 01:22:15 +01:00
'(define-type . cl--typedef-regexp)))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(define-button-type 'cl-type-definition
:supertype 'help-function-def
'help-echo "mouse-2, RET: find type definition")
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(declare-function help-fns-short-filename "help-fns" (filename))
;;;###autoload
(defun cl-find-class (type)
"Return CL class of TYPE.
Call `cl--find-class' to get TYPE's propname `cl--class'"
(cl--find-class type))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(declare-function help-fns--setup-xref-backend "help-fns" ())
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;;;###autoload
(defun cl-describe-type (type &optional _buf _frame)
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
"Display the documentation for type TYPE (a symbol)."
(interactive
(let ((str (completing-read "Describe type: " obarray #'cl-find-class t)))
(if (<= (length str) 0)
(user-error "Abort!")
(list (intern str)))))
(help-setup-xref (list #'cl-describe-type type)
(called-interactively-p 'interactive))
(save-excursion
(with-help-window (help-buffer)
(with-current-buffer standard-output
(let ((class (cl-find-class type)))
(if class
(cl--describe-class type class)
;; FIXME: Describe other types (the built-in ones, or those from
;; cl-deftype).
(user-error "Unknown type %S" type))))
(with-current-buffer standard-output
(help-fns--setup-xref-backend)
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;; Return the text we displayed.
(buffer-string)))))
(defun cl--class-children (class)
(let ((children '()))
(mapatoms
(lambda (sym)
(let ((sym-class (cl--find-class sym)))
(and sym-class (memq class (cl--class-parents sym-class))
(push sym children)))))
children))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(defun cl--describe-class (type &optional class)
(unless class (setq class (cl--find-class type)))
(let ((location (find-lisp-object-file-name type 'define-type))
(metatype (type-of class)))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(insert (symbol-name type)
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(substitute-command-keys " is a type (of kind `"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(help-insert-xref-button (symbol-name metatype)
'help-type metatype)
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(insert (substitute-command-keys "')"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(when location
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(insert (substitute-command-keys " in `"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(help-insert-xref-button
(help-fns-short-filename location)
'cl-type-definition type location 'define-type)
(insert (substitute-quotes "'")))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(insert ".\n")
;; Parents.
(let ((pl (cl--class-parents class))
cur)
(when pl
(insert " Inherits from ")
(while (setq cur (pop pl))
(setq cur (cl--class-name cur))
(insert (substitute-quotes "`"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(help-insert-xref-button (symbol-name cur)
'help-type cur)
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(insert (substitute-command-keys (if pl "', " "'"))))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(insert ".\n")))
;; Children.
(let ((ch (cl--class-children class))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
cur)
(when ch
(insert " Children ")
(while (setq cur (pop ch))
(insert (substitute-quotes "`"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(help-insert-xref-button (symbol-name cur)
'help-type cur)
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
(insert (substitute-command-keys (if ch "', " "'"))))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(insert ".\n")))
;; Describe all the slots in this class.
;; Put it before the docstring, since the docstring may want
;; to refer to the slots.
(cl--describe-class-slots class)
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;; Type's documentation.
(let ((doc (cl--class-docstring class)))
(when doc
(insert (if (save-excursion
(or (< (skip-chars-backward "\n") -1) (bobp)))
""
"\n")
doc "\n\n")))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;; Describe all the methods specific to this class.
(let ((generics (cl-generic-all-functions type)))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(when generics
(insert (propertize "Specialized Methods:\n\n" 'face 'bold))
(dolist (generic generics)
(insert (substitute-quotes "`"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(help-insert-xref-button (symbol-name generic)
'help-function generic)
(insert (substitute-quotes "'"))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(pcase-dolist (`(,qualifiers ,args ,doc)
(cl--generic-method-documentation generic type))
(insert (format " %s%S\n" qualifiers args)
(or doc "")))
(insert "\n\n"))))))
(defun cl--describe-class-slot (slot)
(insert
(concat
(propertize "Slot: " 'face 'bold)
(prin1-to-string (cl--slot-descriptor-name slot))
(unless (eq (cl--slot-descriptor-type slot) t)
(concat " type = "
(prin1-to-string (cl--slot-descriptor-type slot))))
;; FIXME: The default init form is treated differently for structs and for
;; eieio objects: for structs, the default is nil, for eieio-objects
;; it's a special "unbound" value.
(unless nil ;; (eq (cl--slot-descriptor-initform slot) eieio-unbound)
(concat " default = "
(prin1-to-string (cl--slot-descriptor-initform slot))))
(when (alist-get :printer (cl--slot-descriptor-props slot))
(concat " printer = "
(prin1-to-string
(alist-get :printer (cl--slot-descriptor-props slot)))))
(when (alist-get :documentation (cl--slot-descriptor-props slot))
(concat "\n "
(substitute-command-keys
(alist-get :documentation (cl--slot-descriptor-props slot)))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
"\n")))
"\n"))
(defun cl--print-table (header rows &optional last-slot-on-next-line)
;; FIXME: Isn't this functionality already implemented elsewhere?
(let ((cols (apply #'vector (mapcar #'string-width header)))
(col-space 2))
(dolist (row rows)
(dotimes (i (length cols))
(let* ((x (pop row))
(curwidth (aref cols i))
(newwidth (if x (string-width x) 0)))
(if (> newwidth curwidth)
(setf (aref cols i) newwidth)))))
(let ((formats '())
(col 0))
(dotimes (i (length cols))
(push (concat (propertize " "
'display
`(space :align-to ,(+ col col-space)))
"%s")
formats)
Prefer incf to cl-incf in emacs-lisp/*.el * lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args): * lisp/emacs-lisp/bindat.el (bindat--type): * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): * lisp/emacs-lisp/chart.el (chart-file-count): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer, cl--print-table): * lisp/emacs-lisp/cl-generic.el (cl--defmethod-doc-pos): * lisp/emacs-lisp/cl-indent.el (common-lisp-loop-part-indentation) (common-lisp-indent-function-1, lisp-indent-defmethod): * lisp/emacs-lisp/cl-lib.el (cl--set-substring): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): * lisp/emacs-lisp/cl-print.el (cl-print--cons-tail) (cl-print--vector-contents, cl-print--struct-contents) (cl-print--string-props): * lisp/emacs-lisp/cl-seq.el (cl-substitute): * lisp/emacs-lisp/comp-cstr.el (comp--range-union) (comp--range-intersection): * lisp/emacs-lisp/comp.el (comp-vec-append, comp--gen-counter) (comp--op-case, comp--limplify-lap-inst, comp--limplify-block) (comp--limplify-function, comp--maybe-add-vmvar, comp--fwprop*): * lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip): * lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/emacs-lisp/ert-x.el (ert-kill-all-test-buffers): * lisp/emacs-lisp/ert.el (ert--stats-set-test-and-result) (ert-write-junit-test-summary-report): * lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist) (memory-report--object-size-1): * lisp/emacs-lisp/oclosure.el (oclosure--index-table) (oclosure--define-functions): * lisp/emacs-lisp/package.el (package-menu--perform-transaction): * lisp/emacs-lisp/smie.el (smie-set-prec2tab, smie-prec2->grammar) (smie-config--guess, smie-config--guess-1): * lisp/emacs-lisp/syntax.el (syntax-propertize-rules) (syntax-ppss--update-stats): * lisp/emacs-lisp/track-changes.el (track-changes--after): Prefer incf to cl-incf.
2025-02-23 00:13:21 +01:00
(incf col (+ col-space (aref cols i))))
(let ((format (mapconcat #'identity (nreverse formats))))
(insert (apply #'format format
(mapcar (lambda (str) (propertize str 'face 'italic))
header))
"\n")
(insert (apply #'format format
(mapcar (lambda (str) (make-string (string-width str) ?—))
header))
"\n")
(dolist (row rows)
(insert (apply #'format format row) "\n")
(when last-slot-on-next-line
(dolist (line (string-lines (car (last row))))
(insert " " line "\n"))
(insert "\n")))))))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(defun cl--describe-class-slots (class)
"Print help description for the slots in CLASS.
Outputs to the current buffer."
(let* ((slots (cl--class-slots class))
(metatype (type-of class))
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
;; ¡For EIEIO!
(cslots (condition-case nil
(cl-struct-slot-value metatype 'class-slots class)
(cl-struct-unknown-slot nil))))
(if (and (null slots) (eq metatype 'built-in-class))
(insert "This is a built-in type.\n")
(insert (propertize "Instance Allocated Slots:\n\n"
'face 'bold))
(let* ((has-doc nil)
(slots-strings
(mapcar
(lambda (slot)
(list (cl-prin1-to-string (cl--slot-descriptor-name slot))
(let ((type (cl--slot-descriptor-type slot)))
(cond
((eq type t) "")
((and type (symbolp type) (cl--find-class type))
(make-text-button (symbol-name type) nil
'type 'help-type
'help-args (list type)))
(t (cl-prin1-to-string type))))
(cl-prin1-to-string (cl--slot-descriptor-initform slot))
(let ((doc (alist-get :documentation
(cl--slot-descriptor-props slot))))
(if (not doc) ""
(setq has-doc t)
(substitute-command-keys doc)))))
slots)))
(cl--print-table `("Name" "Type" "Default") slots-strings has-doc)))
(insert "\n")
Add online-help support to describe types * lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
2015-07-07 02:14:16 -04:00
(when (> (length cslots) 0)
(insert (propertize "\nClass Allocated Slots:\n\n" 'face 'bold))
(mapc #'cl--describe-class-slot cslots))))
1993-07-30 20:15:09 +00:00
;;;; Method dispatch on `cl-deftype' types (a.k.a "derived types").
;; Extend `cl-deftype' to define data types which are also valid
;; argument types for dispatching generic function methods (see also
;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77725>).
;;
;; The main entry points are:
;;
;; - `cl-deftype', that defines new data types.
;;
;; - `cl-types-of', that returns the types an object belongs to.
;; Ensure each type satisfies `eql'.
(defvar cl--types-of-memo (make-hash-table :test 'equal)
"Memoization table used in `cl-types-of'.")
;; FIXME: `cl-types-of' CPU cost is proportional to the number of types
;; defined with `cl-deftype', so the more popular it gets, the slower
;; it becomes. And of course, the cost of each type check is
;; unbounded, so a single "expensive" type can slow everything down
;; further.
;;
;; The usual dispatch is
;;
;; (lambda (arg &rest args)
;; (let ((f (gethash (cl-typeof arg) precomputed-methods-table)))
;; (if f
;; (apply f arg args)
;; ;; Slow case when encountering a new type
;; ...)))
;;
;; where often the most expensive part is `&rest' (which has to
;; allocate a list for those remaining arguments),
;;
;; So we're talking about replacing
;;
;; &rest + cl-type-of + gethash + if + apply
;;
;; with a function that loops over N types, calling `cl-typep' on each
;; one of them (`cl-typep' itself being a recursive function that
;; basically interprets the type language). This is going to slow
;; down dispatch very significantly for those generic functions that
;; have a method that dispatches on a derived type, compared to
;; those that don't.
;;
;; As a simple optimization, the method dispatch tests only those
;; derived types which have been used as a specialize in a method.
;;
;; A possible further improvement:
;;
;; - based on the PARENTS declaration, create a map from builtin-type
;; to the set of cl-types that have that builtin-type among their
;; parents. That presumes some PARENTS include some builtin-types,
;; obviously otherwise the map will be trivial with all cl-types
;; associated with the `t' "dummy parent". [ We could even go crazy
;; and try and guess PARENTS when not provided, by analyzing the
;; type's definition. ]
;; - in `cl-types-of' start by calling `cl-type-of', then use the map
;; to find which cl-types may need to be checked.
;;
;;;###autoload
(defun cl-types-of (object &optional types)
"Return the atomic types OBJECT belongs to.
Return an unique list of types OBJECT belongs to, ordered from the
most specific type to the most general.
TYPES is an internal argument."
(let* ((found nil))
;; Build a list of all types OBJECT belongs to.
(dolist (type (or types cl--derived-type-list))
(let ((pred (get type 'cl-deftype-satisfies)))
(and
;; If OBJECT is of type, add type to the matching list.
(if types
;; For method dispatch, we don't need to filter out errors,
;; since we can presume that method dispatch is used only on
;; sanely-defined types.
(funcall pred object)
(condition-case-unless-debug e
(funcall pred object)
(error (setq cl--derived-type-list
(delq type cl--derived-type-list))
(warn "cl-types-of %S: %s"
type (error-message-string e))
nil)))
(push type found))))
(push (cl-type-of object) found)
;; Return the list of types OBJECT belongs to, which is also the list
;; of specifiers for OBJECT. This memoization has two purposes:
;; - Speed up computation.
;; - Make sure we always return the same (eq) object, so that the
;; method dispatch's own caching works as it should.
(with-memoization (gethash found cl--types-of-memo)
;; Compute an ordered list of types from the DAG.
(let (dag)
(dolist (type found)
(push (cl--class-allparents (cl--find-class type)) dag))
(merge-ordered-lists dag)))))
(defvar cl--derived-type-dispatch-list nil
"List of types that need to be checked during dispatch.")
(cl-generic-define-generalizer cl--derived-type-generalizer
;; FIXME: This priority can't be always right. :-(
;; E.g. a method dispatching on a type like (or number function),
;; should take precedence over a method on `t' but not over a method
;; on `number'. Similarly a method dispatching on a type like
;; (satisfies (lambda (x) (equal x '(A . B)))) should take precedence
;; over a method on (head 'A).
;; Fixing this 100% is impossible so this generalizer is condemned to
;; suffer from "undefined method ordering" problems, unless/until we
;; restrict it somehow to a subset that we can handle reliably.
20 ;; "typeof" < "cl-types-of" < "head" priority
(lambda (obj &rest _) `(cl-types-of ,obj cl--derived-type-dispatch-list))
(lambda (tag &rest _) (if (consp tag) tag)))
;;;###autoload
(defun cl--derived-type-generalizers (type)
;; Make sure this derived type can be used without arguments.
(let ((expander (or (get type 'cl-deftype-handler)
(error "Type %S lacks cl-deftype-handler" type))))
;; Check that the type can be used without arguments.
(funcall expander)
;; Check that we have a precomputed predicate since that's what
;; `cl-types-of' uses.
(unless (get type 'cl-deftype-satisfies)
(error "Type %S lacks cl-deftype-satisfies" type)))
;; Add a new dispatch type to the dispatch list, then
;; synchronize with `cl--derived-type-list' so that both lists follow
;; the same type precedence order.
;; The `merge-ordered-lists' is `cl-types-of' should we make this
;; ordering unnecessary, but it's still handy for all those types
;; that don't declare their parents.
(unless (memq type cl--derived-type-dispatch-list)
(setq cl--derived-type-dispatch-list
(seq-intersection cl--derived-type-list
(cons type cl--derived-type-dispatch-list))))
(list cl--derived-type-generalizer))
;;;; Trailer
1993-07-30 20:15:09 +00:00
(make-obsolete-variable 'cl-extra-load-hook
"use `with-eval-after-load' instead." "28.1")
1993-07-30 20:15:09 +00:00
(run-hooks 'cl-extra-load-hook)
;; Local variables:
;; generated-autoload-file: "cl-loaddefs.el"
;; End:
(provide 'cl-extra)
1993-07-30 20:15:09 +00:00
;;; cl-extra.el ends here