diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2005-05-28 21:04:38 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2005-05-28 21:04:38 +0000 |
commit | 93d7a3669284221c9272784875f69c047873fe04 (patch) | |
tree | 853af54aa3e46a73bd248dc7033dbf4e39132f9f /lisp/emacs-lisp | |
parent | b4bb3cbc7caca5c9c207d9ed42cacb978790af67 (diff) | |
parent | 9594f9294b16c3e828b593c4cc9159b6328e1aa3 (diff) | |
download | emacs-93d7a3669284221c9272784875f69c047873fe04.tar.gz emacs-93d7a3669284221c9272784875f69c047873fe04.tar.bz2 emacs-93d7a3669284221c9272784875f69c047873fe04.zip |
Merged from miles@gnu.org--gnu-2005 (patch 70-73, 320-331)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-320
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-321
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-322
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-323
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-324
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-325
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-326
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-328
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-329
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-330
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-331
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-70
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-71
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-72
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-73
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-348
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 21 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 70 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 38 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-seq.el | 209 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl.el | 69 | ||||
-rw-r--r-- | lisp/emacs-lisp/derived.el | 1 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 6 | ||||
-rw-r--r-- | lisp/emacs-lisp/easymenu.el | 14 | ||||
-rw-r--r-- | lisp/emacs-lisp/re-builder.el | 2 |
9 files changed, 248 insertions, 182 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index ac6093a4660..e5b429604c7 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4055,27 +4055,6 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'." (setq command-line-args-left (cdr command-line-args-left))) (kill-emacs 0)) - -(make-obsolete-variable 'auto-fill-hook 'auto-fill-function "before 19.15") -(make-obsolete-variable 'blink-paren-hook 'blink-paren-function "before 19.15") -(make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function "before 19.15") -(make-obsolete-variable 'inhibit-local-variables - "use enable-local-variables (with the reversed sense)." - "before 19.15") -(make-obsolete-variable 'unread-command-event - "use unread-command-events; which is a list of events rather than a single event." - "before 19.15") -(make-obsolete-variable 'suspend-hooks 'suspend-hook "before 19.15") -(make-obsolete-variable 'comment-indent-hook 'comment-indent-function "before 19.15") -(make-obsolete-variable 'meta-flag "use the set-input-mode function instead." "before 19.34") -(make-obsolete-variable 'before-change-function - "use before-change-functions; which is a list of functions rather than a single function." - "before 19.34") -(make-obsolete-variable 'after-change-function - "use after-change-functions; which is a list of functions rather than a single function." - "before 19.34") -(make-obsolete-variable 'font-lock-doc-string-face 'font-lock-string-face "before 19.34") - (provide 'byte-compile) (provide 'bytecomp) diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 727e45b1289..4efa87d5937 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -46,7 +46,8 @@ (defun coerce (x type) "Coerce OBJECT to type TYPE. -TYPE is a Common Lisp type specifier." +TYPE is a Common Lisp type specifier. +\n(fn OBJECT TYPE)" (cond ((eq type 'list) (if (listp x) x (append x nil))) ((eq type 'vector) (if (vectorp x) x (vconcat x))) ((eq type 'string) (if (stringp x) x (concat x))) @@ -120,16 +121,17 @@ strings case-insensitively." (nreverse cl-res)))) (defun map (cl-type cl-func cl-seq &rest cl-rest) - "Map a function across one or more sequences, returning a sequence. -TYPE is the sequence type to return, FUNC is the function, and SEQS -are the argument sequences." + "Map a FUNCTION across one or more SEQUENCEs, returning a sequence. +TYPE is the sequence type to return. +\n(fn TYPE FUNCTION SEQUENCE...)" (let ((cl-res (apply 'mapcar* cl-func cl-seq cl-rest))) (and cl-type (coerce cl-res cl-type)))) (defun maplist (cl-func cl-list &rest cl-rest) - "Map FUNC to each sublist of LIST or LISTS. + "Map FUNCTION to each sublist of LIST or LISTs. Like `mapcar', except applies to lists and their cdr's rather than to -the elements themselves." +the elements themselves. +\n(fn FUNCTION LIST...)" (if cl-rest (let ((cl-res nil) (cl-args (cons cl-list (copy-sequence cl-rest))) @@ -146,14 +148,16 @@ the elements themselves." (nreverse cl-res)))) (defun cl-mapc (cl-func cl-seq &rest cl-rest) - "Like `mapcar', but does not accumulate values returned by the function." + "Like `mapcar', but does not accumulate values returned by the function. +\n(fn FUNCTION SEQUENCE...)" (if cl-rest (progn (apply 'map nil cl-func cl-seq cl-rest) cl-seq) (mapc cl-func cl-seq))) (defun mapl (cl-func cl-list &rest cl-rest) - "Like `maplist', but does not accumulate values returned by the function." + "Like `maplist', but does not accumulate values returned by the function. +\n(fn FUNCTION LIST...)" (if cl-rest (apply 'maplist cl-func cl-list cl-rest) (let ((cl-p cl-list)) @@ -161,16 +165,19 @@ the elements themselves." cl-list) (defun mapcan (cl-func cl-seq &rest cl-rest) - "Like `mapcar', but nconc's together the values returned by the function." + "Like `mapcar', but nconc's together the values returned by the function. +\n(fn FUNCTION SEQUENCE...)" (apply 'nconc (apply 'mapcar* cl-func cl-seq cl-rest))) (defun mapcon (cl-func cl-list &rest cl-rest) - "Like `maplist', but nconc's together the values returned by the function." + "Like `maplist', but nconc's together the values returned by the function. +\n(fn FUNCTION LIST...)" (apply 'nconc (apply 'maplist cl-func cl-list cl-rest))) (defun some (cl-pred cl-seq &rest cl-rest) "Return true if PREDICATE is true of any element of SEQ or SEQs. -If so, return the true (non-nil) value returned by PREDICATE." +If so, return the true (non-nil) value returned by PREDICATE. +\n(fn PREDICATE SEQ...)" (if (or cl-rest (nlistp cl-seq)) (catch 'cl-some (apply 'map nil @@ -183,7 +190,8 @@ If so, return the true (non-nil) value returned by PREDICATE." cl-x))) (defun every (cl-pred cl-seq &rest cl-rest) - "Return true if PREDICATE is true of every element of SEQ or SEQs." + "Return true if PREDICATE is true of every element of SEQ or SEQs. +\n(fn PREDICATE SEQ...)" (if (or cl-rest (nlistp cl-seq)) (catch 'cl-every (apply 'map nil @@ -195,11 +203,13 @@ If so, return the true (non-nil) value returned by PREDICATE." (null cl-seq))) (defun notany (cl-pred cl-seq &rest cl-rest) - "Return true if PREDICATE is false of every element of SEQ or SEQs." + "Return true if PREDICATE is false of every element of SEQ or SEQs. +\n(fn PREDICATE SEQ...)" (not (apply 'some cl-pred cl-seq cl-rest))) (defun notevery (cl-pred cl-seq &rest cl-rest) - "Return true if PREDICATE is false of some element of SEQ or SEQs." + "Return true if PREDICATE is false of some element of SEQ or SEQs. +\n(fn PREDICATE SEQ...)" (not (apply 'every cl-pred cl-seq cl-rest))) ;;; Support for `loop'. @@ -332,16 +342,16 @@ If so, return the true (non-nil) value returned by PREDICATE." (setq a (* (/ a (gcd a b)) b)))) a))) -(defun isqrt (a) +(defun isqrt (x) "Return the integer square root of the argument." - (if (and (integerp a) (> a 0)) - (let ((g (cond ((<= a 100) 10) ((<= a 10000) 100) - ((<= a 1000000) 1000) (t a))) + (if (and (integerp x) (> x 0)) + (let ((g (cond ((<= x 100) 10) ((<= x 10000) 100) + ((<= x 1000000) 1000) (t x))) g2) - (while (< (setq g2 (/ (+ g (/ a g)) 2)) g) + (while (< (setq g2 (/ (+ g (/ x g)) 2)) g) (setq g g2)) g) - (if (eq a 0) 0 (signal 'arith-error nil)))) + (if (eq x 0) 0 (signal 'arith-error nil)))) (defun floor* (x &optional y) "Return a list of the floor of X and the fractional part of X. @@ -388,9 +398,9 @@ With two arguments, return rounding and remainder of their quotient." "The remainder of X divided by Y, with the same sign as X." (nth 1 (truncate* x y))) -(defun signum (a) - "Return 1 if A is positive, -1 if negative, 0 if zero." - (cond ((> a 0) 1) ((< a 0) -1) (t 0))) +(defun signum (x) + "Return 1 if X is positive, -1 if negative, 0 if zero." + (cond ((> x 0) 1) ((< x 0) -1) (t 0))) ;; Random numbers. @@ -514,7 +524,8 @@ If START or END is negative, it counts from the end." res)))))) (defun concatenate (type &rest seqs) - "Concatenate, into a sequence of type TYPE, the argument SEQUENCES." + "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs. +\n(fn TYPE SEQUENCE...)" (cond ((eq type 'vector) (apply 'vconcat seqs)) ((eq type 'string) (apply 'concat seqs)) ((eq type 'list) (apply 'append (append seqs '(nil)))) @@ -532,7 +543,7 @@ If START or END is negative, it counts from the end." (nconc (nreverse x) y)) (defun list-length (x) - "Return the length of a list. Return nil if list is circular." + "Return the length of list X. Return nil if list is circular." (let ((n 0) (fast x) (slow x)) (while (and (cdr fast) (not (and (eq fast slow) (> n 0)))) (setq n (+ n 2) fast (cdr (cdr fast)) slow (cdr slow))) @@ -550,7 +561,8 @@ If START or END is negative, it counts from the end." ;;; Property lists. (defun get* (sym tag &optional def) ; See compiler macro in cl-macs.el - "Return the value of SYMBOL's PROPNAME property, or DEFAULT if none." + "Return the value of SYMBOL's PROPNAME property, or DEFAULT if none. +\n(fn SYMBOL PROPNAME &optional DEFAULT)" (or (get sym tag) (and def (let ((plist (symbol-plist sym))) @@ -560,7 +572,8 @@ If START or END is negative, it counts from the end." (defun getf (plist tag &optional def) "Search PROPLIST for property PROPNAME; return its value or DEFAULT. -PROPLIST is a list of the sort returned by `symbol-plist'." +PROPLIST is a list of the sort returned by `symbol-plist'. +\n(fn PROPLIST PROPNAME &optional DEFAULT)" (setplist '--cl-getf-symbol-- plist) (or (get '--cl-getf-symbol-- tag) ;; Originally we called get* here, @@ -582,7 +595,8 @@ PROPLIST is a list of the sort returned by `symbol-plist'." (and (cdr p) (progn (setcdr p (cdr (cdr (cdr p)))) t)))) (defun cl-remprop (sym tag) - "Remove from SYMBOL's plist the property PROP and its value." + "Remove from SYMBOL's plist the property PROPNAME and its value. +\n(fn SYMBOL PROPNAME)" (let ((plist (symbol-plist sym))) (if (and plist (eq tag (car plist))) (progn (setplist sym (cdr (cdr plist))) t) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index a585c7e52e6..4a01181e777 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -207,8 +207,8 @@ and BODY is implicitly surrounded by (block NAME ...). (defmacro function* (func) "Introduce a function. -Like normal `function', except that if argument is a lambda form, its -ARGLIST allows full Common Lisp conventions." +Like normal `function', except that if argument is a lambda form, +its argument list allows full Common Lisp conventions." (if (eq (car-safe func) 'lambda) (let* ((res (cl-transform-lambda (cdr func) 'cl-none)) (form (list 'function (cons 'lambda (cdr res))))) @@ -488,13 +488,14 @@ The result of the body appears to the compiler as a quoted constant." ;;; Conditional control structures. (defmacro case (expr &rest clauses) - "Eval EXPR and choose from CLAUSES on that value. + "Eval EXPR and choose among clauses on that value. Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared against each key in each KEYLIST; the corresponding BODY is evaluated. If no clause succeeds, case returns nil. A single atom may be used in place of a KEYLIST of one atom. A KEYLIST of t or `otherwise' is allowed only in the final clause, and matches if no other keys match. -Key values are compared by `eql'." +Key values are compared by `eql'. +\n(fn EXPR (KEYLIST BODY...)...)" (let* ((temp (if (cl-simple-expr-p expr 3) expr (make-symbol "--cl-var--"))) (head-list nil) (body (cons @@ -522,15 +523,17 @@ Key values are compared by `eql'." (defmacro ecase (expr &rest clauses) "Like `case', but error if no case fits. -`otherwise'-clauses are not allowed." +`otherwise'-clauses are not allowed. +\n(fn EXPR (KEYLIST BODY...)...)" (list* 'case expr (append clauses '((ecase-error-flag))))) (defmacro typecase (expr &rest clauses) - "Evals EXPR, chooses from CLAUSES on that value. + "Evals EXPR, chooses among clauses on that value. Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds, typecase returns nil. A TYPE of t or `otherwise' is allowed only in the -final clause, and matches if no other keys match." +final clause, and matches if no other keys match. +\n(fn EXPR (TYPE BODY...)...)" (let* ((temp (if (cl-simple-expr-p expr 3) expr (make-symbol "--cl-var--"))) (type-list nil) (body (cons @@ -552,7 +555,8 @@ final clause, and matches if no other keys match." (defmacro etypecase (expr &rest clauses) "Like `typecase', but error if no case fits. -`otherwise'-clauses are not allowed." +`otherwise'-clauses are not allowed. +\n(fn EXPR (TYPE BODY...)...)" (list* 'typecase expr (append clauses '((ecase-error-flag))))) @@ -1273,7 +1277,7 @@ before assigning any symbols SYM to the corresponding values. (defmacro progv (symbols values &rest body) "Bind SYMBOLS to VALUES dynamically in BODY. The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. -Each SYMBOL in the first list is bound to the corresponding VALUE in the +Each symbol in the first list is bound to the corresponding value in the second list (or made unbound if VALUES is shorter than SYMBOLS); then the BODY forms are executed and their result is returned. This is much like a `let' form, except that the list of symbols can be computed at run-time." @@ -1284,7 +1288,7 @@ a `let' form, except that the list of symbols can be computed at run-time." ;;; This should really have some way to shadow 'byte-compile properties, etc. (defmacro flet (bindings &rest body) - "Make temporary function defns. + "Make temporary function definitions. This is an analogue of `let' that operates on the function cell of FUNC rather than its value cell. The FORMs are evaluated with the specified function definitions in place, then the definitions are undone (the FUNCs @@ -1311,7 +1315,7 @@ go back to their previous definitions, or lack thereof). body)) (defmacro labels (bindings &rest body) - "Make temporary func bindings. + "Make temporary function bindings. This is like `flet', except the bindings are lexical instead of dynamic. Unlike `flet', this macro is fully compliant with the Common Lisp standard. @@ -1369,7 +1373,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). (defmacro lexical-let (bindings &rest body) "Like `let', but lexically scoped. The main visible difference is that lambdas inside BODY will create -lexical closures as in Common Lisp." +lexical closures as in Common Lisp. +\n(fn VARLIST BODY)" (let* ((cl-closure-vars cl-closure-vars) (vars (mapcar (function (lambda (x) @@ -1411,7 +1416,8 @@ lexical closures as in Common Lisp." (defmacro lexical-let* (bindings &rest body) "Like `let*', but lexically scoped. The main visible difference is that lambdas inside BODY will create -lexical closures as in Common Lisp." +lexical closures as in Common Lisp. +\n(fn VARLIST BODY)" (if (null bindings) (cons 'progn body) (setq bindings (reverse bindings)) (while bindings @@ -1435,7 +1441,7 @@ is analogous to the Common Lisp `multiple-value-bind' macro, using lists to simulate true multiple return values. For compatibility, (values A B C) is a synonym for (list A B C). -\(fn (SYM SYM...) FORM BODY)" +\(fn (SYM...) FORM BODY)" (let ((temp (make-symbol "--cl-var--")) (n -1)) (list* 'let* (cons (list temp form) (mapcar (function @@ -1451,7 +1457,7 @@ each of the symbols SYM in turn. This is analogous to the Common Lisp `multiple-value-setq' macro, using lists to simulate true multiple return values. For compatibility, (values A B C) is a synonym for (list A B C). -\(fn (SYM SYM...) FORM)" +\(fn (SYM...) FORM)" (cond ((null vars) (list 'progn form nil)) ((null (cdr vars)) (list 'setq (car vars) (list 'car form))) (t @@ -1967,7 +1973,7 @@ The form returns true if TAG was found and removed, nil otherwise." Example: (shiftf A B C) sets A to B, B to C, and returns the old A. Each PLACE may be a symbol, or any generalized variable allowed by `setf'. -\(fn PLACE PLACE... VAL)" +\(fn PLACE... VAL)" (cond ((null args) place) ((symbolp place) `(prog1 ,place (setq ,place (shiftf ,@args)))) diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index cb202700a00..35403df1d0b 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -125,8 +125,9 @@ (defun reduce (cl-func cl-seq &rest cl-keys) - "Reduce two-argument FUNCTION across SEQUENCE. -Keywords supported: :start :end :from-end :initial-value :key" + "Reduce two-argument FUNCTION across SEQ. +\nKeywords supported: :start :end :from-end :initial-value :key +\n(fn FUNCTION SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) () (or (listp cl-seq) (setq cl-seq (append cl-seq nil))) (setq cl-seq (subseq cl-seq cl-start cl-end)) @@ -145,7 +146,8 @@ Keywords supported: :start :end :from-end :initial-value :key" (defun fill (seq item &rest cl-keys) "Fill the elements of SEQ with ITEM. -Keywords supported: :start :end" +\nKeywords supported: :start :end +\n(fn SEQ ITEM [KEYWORD VALUE]...)" (cl-parsing-keywords ((:start 0) :end) () (if (listp seq) (let ((p (nthcdr cl-start seq)) @@ -164,7 +166,8 @@ Keywords supported: :start :end" (defun replace (cl-seq1 cl-seq2 &rest cl-keys) "Replace the elements of SEQ1 with the elements of SEQ2. SEQ1 is destructively modified, then returned. -Keywords supported: :start1 :end1 :start2 :end2" +\nKeywords supported: :start1 :end1 :start2 :end2 +\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" (cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) () (if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1)) (or (= cl-start1 cl-start2) @@ -206,7 +209,8 @@ Keywords supported: :start1 :end1 :start2 :end2" "Remove all occurrences of ITEM in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :test :test-not :key :count :start :end :from-end" +\nKeywords supported: :test :test-not :key :count :start :end :from-end +\n(fn ITEM SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end (:start 0) :end) () (if (<= (or cl-count (setq cl-count 8000000)) 0) @@ -250,20 +254,23 @@ Keywords supported: :test :test-not :key :count :start :end :from-end" "Remove all items satisfying PREDICATE in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'remove* nil cl-list :if cl-pred cl-keys)) (defun remove-if-not (cl-pred cl-list &rest cl-keys) "Remove all items not satisfying PREDICATE in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'remove* nil cl-list :if-not cl-pred cl-keys)) (defun delete* (cl-item cl-seq &rest cl-keys) "Remove all occurrences of ITEM in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :test :test-not :key :count :start :end :from-end" +\nKeywords supported: :test :test-not :key :count :start :end :from-end +\n(fn ITEM SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end (:start 0) :end) () (if (<= (or cl-count (setq cl-count 8000000)) 0) @@ -305,23 +312,27 @@ Keywords supported: :test :test-not :key :count :start :end :from-end" (defun delete-if (cl-pred cl-list &rest cl-keys) "Remove all items satisfying PREDICATE in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'delete* nil cl-list :if cl-pred cl-keys)) (defun delete-if-not (cl-pred cl-list &rest cl-keys) "Remove all items not satisfying PREDICATE in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'delete* nil cl-list :if-not cl-pred cl-keys)) (defun remove-duplicates (cl-seq &rest cl-keys) "Return a copy of SEQ with all duplicate elements removed. -Keywords supported: :test :test-not :key :start :end :from-end" +\nKeywords supported: :test :test-not :key :start :end :from-end +\n(fn SEQ [KEYWORD VALUE]...)" (cl-delete-duplicates cl-seq cl-keys t)) (defun delete-duplicates (cl-seq &rest cl-keys) "Remove all duplicate elements from SEQ (destructively). -Keywords supported: :test :test-not :key :start :end :from-end" +\nKeywords supported: :test :test-not :key :start :end :from-end +\n(fn SEQ [KEYWORD VALUE]...)" (cl-delete-duplicates cl-seq cl-keys nil)) (defun cl-delete-duplicates (cl-seq cl-keys cl-copy) @@ -368,7 +379,8 @@ Keywords supported: :test :test-not :key :start :end :from-end" "Substitute NEW for OLD in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :test :test-not :key :count :start :end :from-end" +\nKeywords supported: :test :test-not :key :count :start :end :from-end +\n(fn NEW OLD SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not :count (:start 0) :end :from-end) () (if (or (eq cl-old cl-new) @@ -388,20 +400,23 @@ Keywords supported: :test :test-not :key :count :start :end :from-end" "Substitute NEW for all items satisfying PREDICATE in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys)) (defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys) "Substitute NEW for all items not satisfying PREDICATE in SEQ. This is a non-destructive function; it makes a copy of SEQ if necessary to avoid corrupting the original SEQ. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys)) (defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys) "Substitute NEW for OLD in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :test :test-not :key :count :start :end :from-end" +\nKeywords supported: :test :test-not :key :count :start :end :from-end +\n(fn NEW OLD SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not :count (:start 0) :end :from-end) () (or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0) @@ -433,38 +448,44 @@ Keywords supported: :test :test-not :key :count :start :end :from-end" (defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys) "Substitute NEW for all items satisfying PREDICATE in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys)) (defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys) "Substitute NEW for all items not satisfying PREDICATE in SEQ. This is a destructive function; it reuses the storage of SEQ whenever possible. -Keywords supported: :key :count :start :end :from-end" +\nKeywords supported: :key :count :start :end :from-end +\n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys)) (defun find (cl-item cl-seq &rest cl-keys) - "Find the first occurrence of ITEM in LIST. + "Find the first occurrence of ITEM in SEQ. Return the matching ITEM, or nil if not found. -Keywords supported: :test :test-not :key :start :end :from-end" +\nKeywords supported: :test :test-not :key :start :end :from-end +\n(fn ITEM SEQ [KEYWORD VALUE]...)" (let ((cl-pos (apply 'position cl-item cl-seq cl-keys))) (and cl-pos (elt cl-seq cl-pos)))) (defun find-if (cl-pred cl-list &rest cl-keys) - "Find the first item satisfying PREDICATE in LIST. -Return the matching ITEM, or nil if not found. -Keywords supported: :key :start :end :from-end" + "Find the first item satisfying PREDICATE in SEQ. +Return the matching item, or nil if not found. +\nKeywords supported: :key :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'find nil cl-list :if cl-pred cl-keys)) (defun find-if-not (cl-pred cl-list &rest cl-keys) - "Find the first item not satisfying PREDICATE in LIST. -Return the matching ITEM, or nil if not found. -Keywords supported: :key :start :end :from-end" + "Find the first item not satisfying PREDICATE in SEQ. +Return the matching item, or nil if not found. +\nKeywords supported: :key :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'find nil cl-list :if-not cl-pred cl-keys)) (defun position (cl-item cl-seq &rest cl-keys) - "Find the first occurrence of ITEM in LIST. + "Find the first occurrence of ITEM in SEQ. Return the index of the matching item, or nil if not found. -Keywords supported: :test :test-not :key :start :end :from-end" +\nKeywords supported: :test :test-not :key :start :end :from-end +\n(fn ITEM SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end :from-end) () (cl-position cl-item cl-seq cl-start cl-end cl-from-end))) @@ -491,20 +512,23 @@ Keywords supported: :test :test-not :key :start :end :from-end" (and (< cl-start cl-end) cl-start)))) (defun position-if (cl-pred cl-list &rest cl-keys) - "Find the first item satisfying PREDICATE in LIST. + "Find the first item satisfying PREDICATE in SEQ. Return the index of the matching item, or nil if not found. -Keywords supported: :key :start :end :from-end" +\nKeywords supported: :key :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'position nil cl-list :if cl-pred cl-keys)) (defun position-if-not (cl-pred cl-list &rest cl-keys) - "Find the first item not satisfying PREDICATE in LIST. + "Find the first item not satisfying PREDICATE in SEQ. Return the index of the matching item, or nil if not found. -Keywords supported: :key :start :end :from-end" +\nKeywords supported: :key :start :end :from-end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'position nil cl-list :if-not cl-pred cl-keys)) (defun count (cl-item cl-seq &rest cl-keys) - "Count the number of occurrences of ITEM in LIST. -Keywords supported: :test :test-not :key :start :end" + "Count the number of occurrences of ITEM in SEQ. +\nKeywords supported: :test :test-not :key :start :end +\n(fn ITEM SEQ [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) () (let ((cl-count 0) cl-x) (or cl-end (setq cl-end (length cl-seq))) @@ -516,20 +540,23 @@ Keywords supported: :test :test-not :key :start :end" cl-count))) (defun count-if (cl-pred cl-list &rest cl-keys) - "Count the number of items satisfying PREDICATE in LIST. -Keywords supported: :key :start :end" + "Count the number of items satisfying PREDICATE in SEQ. +\nKeywords supported: :key :start :end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'count nil cl-list :if cl-pred cl-keys)) (defun count-if-not (cl-pred cl-list &rest cl-keys) - "Count the number of items not satisfying PREDICATE in LIST. -Keywords supported: :key :start :end" + "Count the number of items not satisfying PREDICATE in SEQ. +\nKeywords supported: :key :start :end +\n(fn PREDICATE SEQ [KEYWORD VALUE]...)" (apply 'count nil cl-list :if-not cl-pred cl-keys)) (defun mismatch (cl-seq1 cl-seq2 &rest cl-keys) "Compare SEQ1 with SEQ2, return index of first mismatching element. Return nil if the sequences match. If one sequence is a prefix of the other, the return value indicates the end of the shorter sequence. -Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" +\nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end +\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :from-end (:start1 0) :end1 (:start2 0) :end2) () (or cl-end1 (setq cl-end1 (length cl-seq1))) @@ -558,7 +585,8 @@ Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" "Search for SEQ1 as a subsequence of SEQ2. Return the index of the leftmost element of the first match found; return nil if there are no matches. -Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" +\nKeywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end +\n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :from-end (:start1 0) :end1 (:start2 0) :end2) () (or cl-end1 (setq cl-end1 (length cl-seq1))) @@ -580,9 +608,10 @@ Keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end" (and (< cl-start2 cl-end2) cl-pos))))) (defun sort* (cl-seq cl-pred &rest cl-keys) - "Sort the argument SEQUENCE according to PREDICATE. -This is a destructive function; it reuses the storage of SEQUENCE if possible. -Keywords supported: :key" + "Sort the argument SEQ according to PREDICATE. +This is a destructive function; it reuses the storage of SEQ if possible. +\nKeywords supported: :key +\n(fn SEQ PREDICATE [KEYWORD VALUE]...)" (if (nlistp cl-seq) (replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys)) (cl-parsing-keywords (:key) () @@ -593,16 +622,18 @@ Keywords supported: :key" (funcall cl-key cl-y))))))))) (defun stable-sort (cl-seq cl-pred &rest cl-keys) - "Sort the argument SEQUENCE stably according to PREDICATE. -This is a destructive function; it reuses the storage of SEQUENCE if possible. -Keywords supported: :key" + "Sort the argument SEQ stably according to PREDICATE. +This is a destructive function; it reuses the storage of SEQ if possible. +\nKeywords supported: :key +\n(fn SEQ PREDICATE [KEYWORD VALUE]...)" (apply 'sort* cl-seq cl-pred cl-keys)) (defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys) "Destructively merge the two sequences to produce a new sequence. -TYPE is the sequence type to return, SEQ1 and SEQ2 are the two -argument sequences, and PRED is a `less-than' predicate on the elements. -Keywords supported: :key" +TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument +sequences, and PREDICATE is a `less-than' predicate on the elements. +\nKeywords supported: :key +\n(fn TYPE SEQ1 SEQ2 PREDICATE [KEYWORD VALUE]...)" (or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil))) (or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil))) (cl-parsing-keywords (:key) () @@ -618,7 +649,8 @@ Keywords supported: :key" (defun member* (cl-item cl-list &rest cl-keys) "Find the first occurrence of ITEM in LIST. Return the sublist of LIST whose car is ITEM. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ITEM LIST [KEYWORD VALUE]...)" (if cl-keys (cl-parsing-keywords (:test :test-not :key :if :if-not) () (while (and cl-list (not (cl-check-test cl-item (car cl-list)))) @@ -631,13 +663,15 @@ Keywords supported: :test :test-not :key" (defun member-if (cl-pred cl-list &rest cl-keys) "Find the first item satisfying PREDICATE in LIST. Return the sublist of LIST whose car matches. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'member* nil cl-list :if cl-pred cl-keys)) (defun member-if-not (cl-pred cl-list &rest cl-keys) "Find the first item not satisfying PREDICATE in LIST. Return the sublist of LIST whose car matches. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'member* nil cl-list :if-not cl-pred cl-keys)) (defun cl-adjoin (cl-item cl-list &rest cl-keys) @@ -649,7 +683,8 @@ Keywords supported: :key" ;;; See compiler macro in cl-macs.el (defun assoc* (cl-item cl-alist &rest cl-keys) "Find the first item whose car matches ITEM in LIST. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ITEM LIST [KEYWORD VALUE]...)" (if cl-keys (cl-parsing-keywords (:test :test-not :key :if :if-not) () (while (and cl-alist @@ -663,17 +698,20 @@ Keywords supported: :test :test-not :key" (defun assoc-if (cl-pred cl-list &rest cl-keys) "Find the first item whose car satisfies PREDICATE in LIST. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'assoc* nil cl-list :if cl-pred cl-keys)) (defun assoc-if-not (cl-pred cl-list &rest cl-keys) "Find the first item whose car does not satisfy PREDICATE in LIST. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'assoc* nil cl-list :if-not cl-pred cl-keys)) (defun rassoc* (cl-item cl-alist &rest cl-keys) "Find the first item whose cdr matches ITEM in LIST. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ITEM LIST [KEYWORD VALUE]...)" (if (or cl-keys (numberp cl-item)) (cl-parsing-keywords (:test :test-not :key :if :if-not) () (while (and cl-alist @@ -685,12 +723,14 @@ Keywords supported: :test :test-not :key" (defun rassoc-if (cl-pred cl-list &rest cl-keys) "Find the first item whose cdr satisfies PREDICATE in LIST. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'rassoc* nil cl-list :if cl-pred cl-keys)) (defun rassoc-if-not (cl-pred cl-list &rest cl-keys) "Find the first item whose cdr does not satisfy PREDICATE in LIST. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn PREDICATE LIST [KEYWORD VALUE]...)" (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys)) (defun union (cl-list1 cl-list2 &rest cl-keys) @@ -698,7 +738,8 @@ Keywords supported: :key" The result list contains all items that appear in either LIST1 or LIST2. This is a non-destructive function; it makes a copy of the data if necessary to avoid corrupting the original LIST1 and LIST2. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) ((equal cl-list1 cl-list2) cl-list1) (t @@ -717,7 +758,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in either LIST1 or LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) (t (apply 'union cl-list1 cl-list2 cl-keys)))) @@ -726,7 +768,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in both LIST1 and LIST2. This is a non-destructive function; it makes a copy of the data if necessary to avoid corrupting the original LIST1 and LIST2. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (and cl-list1 cl-list2 (if (equal cl-list1 cl-list2) cl-list1 (cl-parsing-keywords (:key) (:test :test-not) @@ -747,7 +790,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in both LIST1 and LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys))) (defun set-difference (cl-list1 cl-list2 &rest cl-keys) @@ -755,7 +799,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in LIST1 but not LIST2. This is a non-destructive function; it makes a copy of the data if necessary to avoid corrupting the original LIST1 and LIST2. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (if (or (null cl-list1) (null cl-list2)) cl-list1 (cl-parsing-keywords (:key) (:test :test-not) (let ((cl-res nil)) @@ -773,7 +818,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in LIST1 but not LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (if (or (null cl-list1) (null cl-list2)) cl-list1 (apply 'set-difference cl-list1 cl-list2 cl-keys))) @@ -782,7 +828,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in exactly one of LIST1, LIST2. This is a non-destructive function; it makes a copy of the data if necessary to avoid corrupting the original LIST1 and LIST2. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) ((equal cl-list1 cl-list2) nil) (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys) @@ -793,7 +840,8 @@ Keywords supported: :test :test-not :key" The result list contains all items that appear in exactly one of LIST1, LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1) ((equal cl-list1 cl-list2) nil) (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys) @@ -802,7 +850,8 @@ Keywords supported: :test :test-not :key" (defun subsetp (cl-list1 cl-list2 &rest cl-keys) "Return true if LIST1 is a subset of LIST2. I.e., if every element of LIST1 also appears in LIST2. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (cond ((null cl-list1) t) ((null cl-list2) nil) ((equal cl-list1 cl-list2) t) (t (cl-parsing-keywords (:key) (:test :test-not) @@ -815,38 +864,44 @@ Keywords supported: :test :test-not :key" (defun subst-if (cl-new cl-pred cl-tree &rest cl-keys) "Substitute NEW for elements matching PREDICATE in TREE (non-destructively). Return a copy of TREE with all matching elements replaced by NEW. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) (defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys) "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively). Return a copy of TREE with all non-matching elements replaced by NEW. -Keywords supported: :key" +\nKeywords supported: :key +\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) (defun nsubst (cl-new cl-old cl-tree &rest cl-keys) "Substitute NEW for OLD everywhere in TREE (destructively). Any element of TREE which is `eql' to OLD is changed to NEW (via a call to `setcar'). -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn NEW OLD TREE [KEYWORD VALUE]...)" (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys)) (defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys) "Substitute NEW for elements matching PREDICATE in TREE (destructively). Any element of TREE which matches is changed to NEW (via a call to `setcar'). -Keywords supported: :key" +\nKeywords supported: :key +\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys)) (defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys) "Substitute NEW for elements not matching PREDICATE in TREE (destructively). Any element of TREE which matches is changed to NEW (via a call to `setcar'). -Keywords supported: :key" +\nKeywords supported: :key +\n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys)) (defun sublis (cl-alist cl-tree &rest cl-keys) "Perform substitutions indicated by ALIST in TREE (non-destructively). Return a copy of TREE with all matching elements replaced. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ALIST TREE [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not) () (cl-sublis-rec cl-tree))) @@ -867,7 +922,8 @@ Keywords supported: :test :test-not :key" (defun nsublis (cl-alist cl-tree &rest cl-keys) "Perform substitutions indicated by ALIST in TREE (destructively). Any matching element of TREE is changed via a call to `setcar'. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ALIST TREE [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key :if :if-not) () (let ((cl-hold (list cl-tree))) (cl-nsublis-rec cl-hold) @@ -888,9 +944,10 @@ Keywords supported: :test :test-not :key" (setq cl-tree (cdr cl-tree)))))) (defun tree-equal (cl-x cl-y &rest cl-keys) - "Return t if trees X and Y have `eql' leaves. + "Return t if trees TREE1 and TREE2 have `eql' leaves. Atoms are compared by `eql'; cons cells are compared recursively. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn TREE1 TREE2 [KEYWORD VALUE]...)" (cl-parsing-keywords (:test :test-not :key) () (cl-tree-equal-rec cl-x cl-y))) diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el index 11835629bd7..e7f736cfd72 100644 --- a/lisp/emacs-lisp/cl.el +++ b/lisp/emacs-lisp/cl.el @@ -112,16 +112,6 @@ a future Emacs interpreter will be able to use it.") (defun cl-cannot-unload () (error "Cannot unload the feature `cl'")) -;;; Predicates. - -(defun eql (a b) ; See compiler macro in cl-macs.el - "Return t if the two args are the same Lisp object. -Floating-point numbers of equal value are `eql', but they may not be `eq'." - (if (numberp a) - (equal a b) - (eq a b))) - - ;;; Generalized variables. These macros are defined here so that they ;;; can safely be used in .emacs files. @@ -162,7 +152,8 @@ be a symbol, or any generalized variable allowed by `setf'." "(pushnew X PLACE): insert X at the head of the list if not already there. Like (push X PLACE), except that the list is unmodified if X is `eql' to an element already on the list. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn X PLACE [KEYWORD VALUE]...)" (if (symbolp place) (list 'setq place (list* 'adjoin x place keys)) (list* 'callf2 'adjoin x place keys))) @@ -256,7 +247,8 @@ Otherwise, the macro is expanded and the expansion is considered in place of FORM. When a non-macro-call results, it is returned. The second optional arg ENVIRONMENT specifies an environment of macro -definitions to shadow the loaded ones for use in file byte-compilation." +definitions to shadow the loaded ones for use in file byte-compilation. +\n(fn FORM &optional ENVIRONMENT)" (let ((cl-macro-environment cl-env)) (while (progn (setq cl-macro (funcall cl-old-macroexpand cl-macro cl-env)) (and (symbolp cl-macro) @@ -300,27 +292,27 @@ definitions to shadow the loaded ones for use in file byte-compilation." ;;; Numbers. -(defun floatp-safe (x) +(defun floatp-safe (object) "Return t if OBJECT is a floating point number. On Emacs versions that lack floating-point support, this function always returns nil." - (and (numberp x) (not (integerp x)))) + (and (numberp object) (not (integerp object)))) -(defun plusp (x) +(defun plusp (number) "Return t if NUMBER is positive." - (> x 0)) + (> number 0)) -(defun minusp (x) +(defun minusp (number) "Return t if NUMBER is negative." - (< x 0)) + (< number 0)) -(defun oddp (x) +(defun oddp (integer) "Return t if INTEGER is odd." - (eq (logand x 1) 1)) + (eq (logand integer 1) 1)) -(defun evenp (x) +(defun evenp (integer) "Return t if INTEGER is even." - (eq (logand x 1) 0)) + (eq (logand integer 1) 0)) (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time))) @@ -344,7 +336,8 @@ always returns nil." If there are several SEQs, FUNCTION is called with that many arguments, and mapping stops as soon as the shortest list runs out. With just one SEQ, this is like `mapcar'. With several, it is like the Common Lisp -`mapcar' function extended to arbitrary sequence types." +`mapcar' function extended to arbitrary sequence types. +\n(fn FUNCTION SEQ...)" (if cl-rest (if (or (cdr cl-rest) (nlistp cl-x) (nlistp (car cl-rest))) (cl-mapcar-many cl-func (cons cl-x cl-rest)) @@ -503,9 +496,10 @@ SEQ, this is like `mapcar'. With several, it is like the Common Lisp ;; x)) (defun list* (arg &rest rest) ; See compiler macro in cl-macs.el - "Return a new list with specified args as elements, consed to last arg. + "Return a new list with specified ARGs as elements, consed to last ARG. Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to -`(cons A (cons B (cons C D)))'." +`(cons A (cons B (cons C D)))'. +\n(fn ARG...)" (cond ((not rest) arg) ((not (cdr rest)) (cons arg (car rest))) (t (let* ((n (length rest)) @@ -522,8 +516,8 @@ Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to (nreverse res))) (defun copy-list (list) - "Return a copy of a list, which may be a dotted list. -The elements of the list are not copied, just the list structure itself." + "Return a copy of LIST, which may be a dotted list. +The elements of LIST are not copied, just the list structure itself." (if (consp list) (let ((res nil)) (while (consp list) (push (pop list) res)) @@ -544,7 +538,8 @@ The elements of the list are not copied, just the list structure itself." (defun adjoin (cl-item cl-list &rest cl-keys) ; See compiler macro in cl-macs "Return ITEM consed onto the front of LIST only if it's not already there. Otherwise, return LIST unmodified. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn ITEM LIST [KEYWORD VALUE]...)" (cond ((or (equal cl-keys '(:test eq)) (and (null cl-keys) (not (numberp cl-item)))) (if (memq cl-item cl-list) cl-list (cons cl-item cl-list))) @@ -555,7 +550,8 @@ Keywords supported: :test :test-not :key" (defun subst (cl-new cl-old cl-tree &rest cl-keys) "Substitute NEW for OLD everywhere in TREE (non-destructively). Return a copy of TREE with all elements `eql' to OLD replaced by NEW. -Keywords supported: :test :test-not :key" +\nKeywords supported: :test :test-not :key +\n(fn NEW OLD TREE [KEYWORD VALUE]...)" (if (or cl-keys (and (numberp cl-old) (not (integerp cl-old)))) (apply 'sublis (list (cons cl-old cl-new)) cl-tree cl-keys) (cl-do-subst cl-new cl-old cl-tree))) @@ -569,8 +565,17 @@ Keywords supported: :test :test-not :key" cl-tree (cons a d)))) (t cl-tree))) -(defun acons (a b c) (cons (cons a b) c)) -(defun pairlis (a b &optional c) (nconc (mapcar* 'cons a b) c)) +(defun acons (key value alist) + "Add KEY and VALUE to ALIST. +Return a new list with (cons KEY VALUE) as car and ALIST as cdr." + (cons (cons key value) alist)) + +(defun pairlis (keys values &optional alist) + "Make an alist from KEYS and VALUES. +Return a new alist composed by associating KEYS to corresponding VALUES; +the process stops as soon as KEYS or VALUES run out. +If ALIST is non-nil, the new pairs are prepended to it." + (nconc (mapcar* 'cons keys values) alist)) ;;; Miscellaneous. @@ -699,5 +704,5 @@ Keywords supported: :test :test-not :key" (run-hooks 'cl-load-hook) -;;; arch-tag: 5f07fa74-f153-4524-9303-21f5be125851 +;; arch-tag: 5f07fa74-f153-4524-9303-21f5be125851 ;;; cl.el ends here diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index c00028ad218..5ba9c094355 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -132,6 +132,7 @@ BODY can start with a bunch of keyword arguments. The following keyword arguments are currently understood: :group GROUP Declare the customization group that corresponds to this mode. + The command `customize-mode' uses this. :syntax-table TABLE Use TABLE instead of the default. A nil value means to simply use the same syntax-table as the parent. diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 0892af1bb35..188dc172e07 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -172,7 +172,7 @@ For example, you could write (setq group `(:group ',(intern (replace-regexp-in-string "-mode\\'" "" mode-name))))) - + `(progn ;; Define the variable to enable or disable the mode. ,(if (not globalp) @@ -306,9 +306,9 @@ in which `%s' turns it on." ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode (progn - (add-hook 'find-file-hook ',buffers) + (add-hook 'after-change-major-mode-hook ',buffers) (add-hook 'change-major-mode-hook ',cmmh)) - (remove-hook 'find-file-hook ',buffers) + (remove-hook 'after-change-major-mode-hook ',buffers) (remove-hook 'change-major-mode-hook ',cmmh)) ;; Go through existing buffers. diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index c9f1769ae14..b3160c9b752 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -471,11 +471,15 @@ Contrary to XEmacs, this is a nop on Emacs since menus are automatically (defun easy-menu-add (menu &optional map) "Add the menu to the menubar. -This is a nop on Emacs since menus are automatically activated when the -corresponding keymap is activated. On XEmacs this is needed to actually -add the menu to the current menubar. -Maybe precalculate equivalent key bindings. -Do it only if `easy-menu-precalculate-equivalent-keybindings' is on." +On Emacs, menus are already automatically activated when the +corresponding keymap is activated. On XEmacs this is needed to +actually add the menu to the current menubar. + +This also precalculates equivalent key bindings when +`easy-menu-precalculate-equivalent-keybindings' is on. + +You should call this once the menu and keybindings are set up +completely and menu filter functions can be expected to work." (when easy-menu-precalculate-equivalent-keybindings (if (and (symbolp menu) (not (keymapp menu)) (boundp menu)) (setq menu (symbol-value menu))) diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index a2aed39d00a..8a53c202ed8 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -254,7 +254,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.") mode-name "RE Builder") (use-local-map reb-mode-map) (reb-mode-common) - (run-hooks 'reb-mode-hook)) + (run-mode-hooks 'reb-mode-hook)) (define-derived-mode reb-lisp-mode emacs-lisp-mode "RE Builder Lisp" |