summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-extra.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/cl-extra.el')
-rw-r--r--lisp/emacs-lisp/cl-extra.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index e64623ab44e..b721ceba2ef 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -523,6 +523,10 @@ This sets the values of: `cl-most-positive-float', `cl-most-negative-float',
"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."
+ (declare (gv-setter
+ (lambda (new)
+ `(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end)
+ ,new))))
(if (stringp seq) (substring seq start end)
(let (len)
(and end (< end 0) (setq end (+ end (setq len (length seq)))))
@@ -587,7 +591,8 @@ If START or END is negative, it counts from the end."
(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 (compiler-macro cl--compiler-macro-get))
+ (declare (compiler-macro cl--compiler-macro-get)
+ (gv-setter (lambda (store) `(put ,sym ,tag ,store))))
(or (get sym tag)
(and def
;; Make sure `def' is really absent as opposed to set to nil.
@@ -602,6 +607,15 @@ If START or END is negative, it counts from the end."
"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 (gv-expander
+ (lambda (do)
+ (gv-letplace (getter setter) plist
+ (macroexp-let2 nil k tag
+ (macroexp-let2 nil d def
+ (funcall do `(cl-getf ,getter ,k ,d)
+ (lambda (v)
+ (funcall setter
+ `(cl--set-getf ,getter ,k ,v))))))))))
(setplist '--cl-getf-symbol-- plist)
(or (get '--cl-getf-symbol-- tag)
;; Originally we called cl-get here,