Philip Kaludercic writes: > Augusto Stoffel writes: > >> This buffer-match-p condition does the expected job: >> >> (buffer-match-p '(or "\\*" (derived-mode . special-mode)) >> (current-buffer)) >> >> But this presumably equivalent one gives a “(wrong-type-argument listp >> special-mode)” error: >> >> (buffer-match-p '(or (and "\\*") >> (derived-mode . special-mode)) >> (current-buffer)) > > It seems to me that the issue is related to the `and' being wrapped by > an `or', specifically because of a typo in the handling of `and': > > diff --git a/lisp/subr.el b/lisp/subr.el > index 2ffc594997..0350c16ccf 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -7014,8 +7014,8 @@ buffer-match-p > (funcall match (cdr condition))) > ((eq (car-safe condition) 'and) > (catch 'fail > - (dolist (c (cdr conditions)) > - (unless (funcall match c) > + (dolist (c (cdr condition)) > + (unless (funcall match (list c)) > (throw 'fail nil))) > t))) > (throw 'match t))))))) > > > As you have pointed out to me privately, it might make sense to rewrite > the case distinction using pcase, to avoid simple mistakes like these. That might look something like this: