]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/pcase.el (pcase--fgrep): Look inside vectors
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 11 May 2020 13:53:37 +0000 (09:53 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 11 May 2020 13:53:37 +0000 (09:53 -0400)
lisp/emacs-lisp/pcase.el

index 4b7689ad42c37a5612fb9c99fbbb27376ef8a88c..a8ce23284c4f0eec8e1c62067a92b6ae312e46d4 100644 (file)
@@ -698,10 +698,15 @@ MATCH is the pattern that needs to be matched, of the form:
       (dolist (binding (pcase--fgrep bindings (pop sexp)))
         (push binding res)
         (setq bindings (remove binding bindings))))
-    (let ((tmp (assq sexp bindings)))
-      (if tmp
-          (cons tmp res)
-        res))))
+    (if (vectorp sexp)
+        ;; With backquote, code can appear within vectors as well.
+        ;; This wouldn't be needed if we `macroexpand-all' before
+        ;; calling pcase--fgrep, OTOH.
+        (pcase--fgrep bindings (mapcar #'identity sexp))
+      (let ((tmp (assq sexp bindings)))
+        (if tmp
+            (cons tmp res)
+          res)))))
 
 (defun pcase--self-quoting-p (upat)
   (or (keywordp upat) (integerp upat) (stringp upat)))