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

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 16 Nov 2012 15:34:03 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12854: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12854
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12854: 24.2.50; `display-buffer-alist': conditions are not handled as documented
From: martin rudalics <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Fri, 16 Nov 2012 16:32:51 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

 > 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 lifted this restriction in revision 110885 on the Emacs-24 release
branch.

 > (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.

As a matter of fact, the code called that function with the variable
`display-buffer-alist' as second argument which doesn't make any sense.
I now pass it the ACTION argument of `display-buffer' instead and tried
to document this in the same revision as above.

Thanks, martin

Subject: 24.2.50; `display-buffer-alist': conditions are not handled as documented
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Date: Sat, 10 Nov 2012 20:18:36 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

The doc says:

> display-buffer-alist is a variable defined in `window.el'.
> [...]
> 
> Alist of conditional actions for `display-buffer'.
> This is a list of elements (CONDITION . ACTION), where:
> 
>  CONDITION is either a regexp matching buffer names, or a function
>   that takes a buffer and returns a boolean.

But the CONDITION is handled very differently by
`display-buffer-assq-regexp':

(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.

(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.

Regards,

Michael.

In GNU Emacs 24.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2012-11-01 on dex, modified by Debian
 (emacs-snapshot package, version 2:20121101-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description:	Debian GNU/Linux testing (wheezy)