[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d5e7d9e257e 1/3: Move `setf substring` to cl-lib since it relies
From: |
Stefan Monnier |
Subject: |
master d5e7d9e257e 1/3: Move `setf substring` to cl-lib since it relies on it (bug#60102) |
Date: |
Mon, 4 Sep 2023 16:43:32 -0400 (EDT) |
branch: master
commit d5e7d9e257ee5b6bbccae2dc6476fd91142630d3
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Move `setf substring` to cl-lib since it relies on it (bug#60102)
* lisp/emacs-lisp/cl-lib.el (substring): Move gv-expander here...
* lisp/emacs-lisp/gv.el (substring): ...from here.
---
lisp/emacs-lisp/cl-lib.el | 11 +++++++++++
lisp/emacs-lisp/gv.el | 12 ------------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 7fee780a735..83396dabc1a 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -170,6 +170,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.
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 7adf92c11e0..5d31253fe2d 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -821,17 +821,5 @@ REF must have been previously obtained with `gv-ref'."
((eq ,getter ,val) ,(funcall setter `(not ,val))))))))))
(make-obsolete-generalized-variable 'eq nil "29.1")
-(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))))))))
-
(provide 'gv)
;;; gv.el ends here