1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 11:20:39 -08:00

* lisp/emacs-lisp/pcase.el (pcase--fgrep): Look inside vectors

This commit is contained in:
Stefan Monnier 2020-05-11 09:53:37 -04:00
parent 703115829b
commit a69ef94e22

View file

@ -698,10 +698,15 @@ MATCH is the pattern that needs to be matched, of the form:
(dolist (binding (pcase--fgrep bindings (pop sexp))) (dolist (binding (pcase--fgrep bindings (pop sexp)))
(push binding res) (push binding res)
(setq bindings (remove binding bindings)))) (setq bindings (remove binding bindings))))
(let ((tmp (assq sexp bindings))) (if (vectorp sexp)
(if tmp ;; With backquote, code can appear within vectors as well.
(cons tmp res) ;; This wouldn't be needed if we `macroexpand-all' before
res)))) ;; 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) (defun pcase--self-quoting-p (upat)
(or (keywordp upat) (integerp upat) (stringp upat))) (or (keywordp upat) (integerp upat) (stringp upat)))