GNU bug report logs -
#12854
24.2.50; `display-buffer-alist': conditions are not handled as documented
Previous Next
Reported by: michael_heerdegen <at> web.de
Date: Sat, 10 Nov 2012 19:19:02 UTC
Severity: normal
Found in version 24.2.50
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12854 in the body.
You can then email your comments to 12854 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Sat, 10 Nov 2012 19:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
michael_heerdegen <at> web.de
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 10 Nov 2012 19:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Sat, 10 Nov 2012 19:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 12854 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> 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.
And please, also add to the docstring that the CONDITIONS are tried one
after another until one is fulfilled, and that all other entries are
ignored, or something like that. Just for completeness.
Thanks,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Tue, 13 Nov 2012 13:52:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 12854 <at> debbugs.gnu.org (full text, mbox):
> (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
Reply sent
to
martin rudalics <rudalics <at> gmx.at>
:
You have taken responsibility.
(Fri, 16 Nov 2012 15:34:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
michael_heerdegen <at> web.de
:
bug acknowledged by developer.
(Fri, 16 Nov 2012 15:34:03 GMT)
Full text and
rfc822 format available.
Message #16 received at 12854-done <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Fri, 16 Nov 2012 15:35:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 12854 <at> debbugs.gnu.org (full text, mbox):
> And please, also add to the docstring that the CONDITIONS are tried one
> after another until one is fulfilled, and that all other entries are
> ignored, or something like that. Just for completeness.
Hmm... I tried to do that in revision 110885. Please have a look.
Thanks again, martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Sun, 18 Nov 2012 01:02:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 12854 <at> debbugs.gnu.org (full text, mbox):
martin rudalics <rudalics <at> gmx.at> writes:
> > (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.
Ok, thanks. My stuff works now as it's supposed to.
> > (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.
Looks ok to me, the code as well as the doc.
Thanks,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#12854
; Package
emacs
.
(Sun, 18 Nov 2012 01:03:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 12854 <at> debbugs.gnu.org (full text, mbox):
martin rudalics <rudalics <at> gmx.at> writes:
> > And please, also add to the docstring that the CONDITIONS are tried one
> > after another until one is fulfilled, and that all other entries are
> > ignored, or something like that. Just for completeness.
>
> Hmm... I tried to do that in revision 110885. Please have a look.
Looks also ok to me, thanks!
Regards,
Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 16 Dec 2012 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 272 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.