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.el22
1 files changed, 20 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 87d0b936620..108dcd31f48 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -171,6 +171,17 @@ to an element already in the list stored in PLACE.
val
(and (< end (length str)) (substring str end))))
+(gv-define-expander substring
+ (lambda (do place from &optional to)
+ (gv-letplace (getter setter) place
+ (macroexp-let2* nil ((start from) (end to))
+ (funcall do `(substring ,getter ,start ,end)
+ (lambda (v)
+ (macroexp-let2 nil v v
+ `(progn
+ ,(funcall setter `(cl--set-substring
+ ,getter ,start ,end ,v))
+ ,v))))))))
;;; Blocks and exits.
@@ -204,7 +215,7 @@ should return.
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))
+ (signal 'wrong-type-argument (list list)))
list)
(defsubst cl-multiple-value-list (expression)
@@ -462,6 +473,7 @@ Thus, `(cl-list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
(defun cl-copy-list (list)
"Return a copy of LIST, which may be a dotted list.
The elements of LIST are not copied, just the list structure itself."
+ (declare (side-effect-free error-free))
(if (consp list)
(let ((res nil))
(while (consp list) (push (pop list) res))
@@ -524,7 +536,12 @@ If ALIST is non-nil, the new pairs are prepended to it."
(unless (load "cl-loaddefs" 'noerror 'quiet)
;; When bootstrapping, cl-loaddefs hasn't been built yet!
(require 'cl-macs)
- (require 'cl-seq))
+ (require 'cl-seq)
+ ;; FIXME: Arguably we should also load `cl-extra', except that this
+ ;; currently causes more bootstrap troubles, and `cl-extra' is
+ ;; rarely used, so instead we explicitly (require 'cl-extra) at
+ ;; those rare places where we do need it.
+ )
(defun cl--old-struct-type-of (orig-fun object)
(or (and (vectorp object) (> (length object) 0)
@@ -562,6 +579,7 @@ of record objects."
(advice-add 'type-of :around #'cl--old-struct-type-of))
(t
(advice-remove 'type-of #'cl--old-struct-type-of))))
+(make-obsolete 'cl-old-struct-compat-mode nil "30.1")
(defun cl-constantly (value)
"Return a function that takes any number of arguments, but returns VALUE."