I wrote a set of predicates to filter matches in my ìsearch-*
and query-replace*
routines. I also wrote a macro to bind the isearch-filter-predicate
variable to multiple predicates:
(defmacro with-ifp-predicates (PREDICATES &rest body)
(declare (indent 1))
`(let ((isearch-filter-predicate isearch-filter-predicate))
(mapcar (lambda (x)
(add-function :before-while isearch-filter-predicate x))
,PREDICATES)
,@body))
I use it in my code in this way:
(with-ifp-predicates '(skip-maths skip-comments)
(query-replace "foo" "bar" nil (point-min) (point-max)))
I tested it and it seems to work but if I enter recursive-edit
(C-r
) and look at the value (C-h v
) of the isearch-filter-predicate
variable, I get this:
Is it normal? Is it caused by the :before-while
? I chose it because I need a match to be skipped if just one of the predicats is satisfied.