]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/gv.el (error): Add gv-expander
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 17 Apr 2023 22:15:45 +0000 (18:15 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 17 Apr 2023 22:15:45 +0000 (18:15 -0400)
This fixes incorrect expansion of (setf (case-exhaustive ..) ..),
as found for example in `elpa-admin.el`.

lisp/emacs-lisp/gv.el

index ac001af06bde834f567b8581c5e6d48a5b54c93f..6c3036da2f2e8111916cd5037e74cfe4d85d1034 100644 (file)
@@ -639,6 +639,13 @@ REF must have been previously obtained with `gv-ref'."
 
 ;;; Generalized variables.
 
+;; You'd think noone would write `(setf (error ...) ..)' but it
+;; appears naturally as the result of macroexpansion of things like
+;; (setf (case-exhaustive ...)).
+;; We could generalize this to `throw' and `signal', but it seems
+;; preferable to wait until there's a concrete need.
+(gv-define-expander error (lambda (_do &rest args) `(error . ,args)))
+
 ;; Some Emacs-related place types.
 (gv-define-simple-setter buffer-file-name set-visited-file-name t)
 (make-obsolete-generalized-variable