X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/b0aeb9e30b6f14544e74d6c2b8f6bd030705f886..76da6667542e8756076fe1e80982d63910371199:/packages/el-search/el-search.el diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el index 52e919a9c..a1bdd23e2 100644 --- a/packages/el-search/el-search.el +++ b/packages/el-search/el-search.el @@ -389,6 +389,17 @@ of the definitions is limited to \"el-search\"." `(setf (alist-get ',name el-search--pcase-macros) (lambda ,args ,@body))) +(defun el-search--macroexpand-1 (pattern) + "Expand \"el-search\" PATTERN. +This is like `pcase--macroexpand', but expands only patterns +defined with `el-search-defpattern' and performs only one +expansion step. + +Return PATTERN if this pattern type was not defined with +`el-search-defpattern'." + (if-let ((expander (alist-get (car-safe pattern) el-search--pcase-macros))) + (apply expander (cdr pattern)) + pattern)) (defmacro el-search--with-additional-pcase-macros (&rest body) `(cl-letf ,(mapcar (pcase-lambda (`(,symbol . ,fun)) @@ -590,7 +601,7 @@ matches the list (1 2 3 4 5 6 7 8 9) and binds `x' to (4 5 6)." (pred (lambda (,string) (cl-every (lambda (,regexp) (el-search--smart-string-match-p ,regexp ,string)) - (list ,@regexps))))))) + ',regexps)))))) (el-search-defpattern symbol (&rest regexps) "Matches any symbol whose name is matched by all REGEXPS."