summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-lib.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/cl-lib.el')
-rw-r--r--lisp/emacs-lisp/cl-lib.el38
1 files changed, 18 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 0f5f3c78695..ff096918173 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -110,6 +110,7 @@ a future Emacs interpreter will be able to use it.")
;; These macros are defined here so that they
;; can safely be used in init files.
+;;;###autoload
(defmacro cl-incf (place &optional x)
"Increment PLACE by X (1 by default).
PLACE may be a symbol, or any generalized variable allowed by `setf'.
@@ -129,9 +130,12 @@ The return value is the decremented value of PLACE."
(list 'cl-callf '- place (or x 1))))
(defmacro cl-pushnew (x place &rest keys)
- "(cl-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.
+ "Add X to the list stored in PLACE unless X is already in the list.
+PLACE is a generalized variable that stores a list.
+
+Like (push X PLACE), except that PLACE is unmodified if X is `eql'
+to an element already in the list stored in PLACE.
+
\nKeywords supported: :test :test-not :key
\n(fn X PLACE [KEYWORD VALUE]...)"
(declare (debug
@@ -189,12 +193,16 @@ that the containing function should return.
\(fn &rest VALUES)")
-(cl--defalias 'cl-values-list #'identity
+(defun cl-values-list (list)
"Return multiple values, Common Lisp style, taken from a list.
-LIST specifies the list of values
-that the containing function should return.
+LIST specifies the list of values that the containing function
+should return.
-\(fn LIST)")
+Note that Emacs Lisp doesn't really support multiple values, so
+all this function does is return LIST."
+ (unless (listp list)
+ (signal 'wrong-type-argument list))
+ list)
(defsubst cl-multiple-value-list (expression)
"Return a list of the multiple values produced by EXPRESSION.
@@ -365,13 +373,6 @@ SEQ, this is like `mapcar'. With several, it is like the Common Lisp
(cl--defalias 'cl-second 'cadr)
(cl--defalias 'cl-rest 'cdr)
-(defun cl-endp (x)
- "Return true if X is the empty list; false if it is a cons.
-Signal an error if X is not a list."
- (if (listp x)
- (null x)
- (signal 'wrong-type-argument (list 'listp x 'x))))
-
(cl--defalias 'cl-third 'cl-caddr "Return the third element of the list X.")
(cl--defalias 'cl-fourth 'cl-cadddr "Return the fourth element of the list X.")
@@ -531,8 +532,9 @@ If ALIST is non-nil, the new pairs are prepended to it."
;; Some more Emacs-related place types.
(gv-define-simple-setter buffer-file-name set-visited-file-name t)
(gv-define-setter buffer-modified-p (flag &optional buf)
- `(with-current-buffer ,buf
- (set-buffer-modified-p ,flag)))
+ (macroexp-let2 nil buffer `(or ,buf (current-buffer))
+ `(with-current-buffer ,buffer
+ (set-buffer-modified-p ,flag))))
(gv-define-simple-setter buffer-name rename-buffer t)
(gv-define-setter buffer-string (store)
`(insert (prog1 ,store (erase-buffer))))
@@ -666,8 +668,4 @@ of record objects."
(t
(advice-remove 'type-of #'cl--old-struct-type-of))))
-;; Local variables:
-;; byte-compile-dynamic: t
-;; End:
-
;;; cl-lib.el ends here