diff options
author | Yuan Fu <casouri@gmail.com> | 2022-10-05 14:22:03 -0700 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-10-05 14:22:03 -0700 |
commit | 7ebbd4efc3d45403cf845d35c36c21756baeeba8 (patch) | |
tree | f53223ce7dbd64c079aced6e1a77964d1a8eaa3f /lisp/emacs-lisp/gv.el | |
parent | cb183f6467401fb5ed2b7fc98ca75be9d943cbe3 (diff) | |
parent | 95efafb72664049f8ac825047df3645656cf76f4 (diff) | |
download | emacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.tar.gz emacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.tar.bz2 emacs-7ebbd4efc3d45403cf845d35c36c21756baeeba8.zip |
Merge branch 'master' into feature/tree-sitter
Diffstat (limited to 'lisp/emacs-lisp/gv.el')
-rw-r--r-- | lisp/emacs-lisp/gv.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index eaab6439adb..a96fa19a3ff 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -87,7 +87,11 @@ with a (not necessarily copyable) Elisp expression that returns the value to set it to. DO must return an Elisp expression." (cond - ((symbolp place) (funcall do place (lambda (v) `(setq ,place ,v)))) + ((symbolp place) + (let ((me (macroexpand-1 place macroexpand-all-environment))) + (if (eq me place) + (funcall do place (lambda (v) `(setq ,place ,v))) + (gv-get me do)))) ((not (consp place)) (signal 'gv-invalid-place (list place))) (t (let* ((head (car place)) @@ -532,13 +536,15 @@ The return value is the last VAL in the list. (funcall do `(error . ,args) (lambda (v) `(progn ,v (error . ,args)))))) -(defmacro gv-synthetic-place (getter setter) +(defun gv-synthetic-place (getter setter) "Special place described by its setter and getter. GETTER and SETTER (typically obtained via `gv-letplace') get and -set that place. I.e. This macro allows you to do the \"reverse\" of what -`gv-letplace' does. -This macro only makes sense when used in a place." - (declare (gv-expander funcall)) +set that place. I.e. this function allows you to do the +\"reverse\" of what `gv-letplace' does. + +This function is only useful when used in conjunction with +generalized variables in place forms." + (declare (gv-expander funcall) (compiler-macro (lambda (_) getter))) (ignore setter) getter) @@ -806,6 +812,7 @@ REF must have been previously obtained with `gv-ref'." `(cond (,v ,(funcall setter val)) ((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) |