diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-05-11 09:53:37 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2020-05-11 09:53:37 -0400 |
commit | a69ef94e22716f9cbb7cf8d78b89e7be4a4c60eb (patch) | |
tree | 9980243e5866de205747a5bd472e835a769a64c1 | |
parent | 703115829b35de6a90d7bafb7931f905e79d0d35 (diff) | |
download | emacs-a69ef94e22716f9cbb7cf8d78b89e7be4a4c60eb.tar.gz emacs-a69ef94e22716f9cbb7cf8d78b89e7be4a4c60eb.tar.bz2 emacs-a69ef94e22716f9cbb7cf8d78b89e7be4a4c60eb.zip |
* lisp/emacs-lisp/pcase.el (pcase--fgrep): Look inside vectors
-rw-r--r-- | lisp/emacs-lisp/pcase.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 4b7689ad42c..a8ce23284c4 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -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))) |