Subject: Re: bug#12854: 24.2.50; `display-buffer-alist': conditions are not handled as documented

From: martin rudalics <[email-masked]>
Date: Tue, 13 Nov 2012 14:50:46 +0100

> (defun display-buffer-assq-regexp (buffer-name alist)
 >   "Retrieve ALIST entry corresponding to BUFFER-NAME."
 >   (catch 'match
 >     (dolist (entry alist)
 >       (let ((key (car entry)))
 > 	(when (or (and (stringp key)
 > 		       (string-match-p key buffer-name))
 > 		  (and (symbolp key) (functionp key)
 > 		       (funcall key buffer-name alist)))
 > 	  (throw 'match (cdr entry)))))))
 >
 >
 > Obviously, two things are wrong here:
 >
 > (1) If CONDITION is a function, it currently must be a symbol.  I don't
 > see why lambda expressions should be forbidden.  The user should not
 > need to use defun only to be able specify an argument.

I see no problems with removing the (symbolp key) check.

 > (2) If CONDITION is a function, it takes _two_ arguments: a buffer
 > _name_ (not a buffer) _and_ an alist.  That should be clarified in the
 > docstring.

IIUC the correct solution is to not pass ALIST to the function specified
by `key'.

martin