unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18181: bug in display-buffer-below-selected
@ 2014-08-03 10:59 Trevor Jim
  2014-08-04 17:22 ` martin rudalics
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Trevor Jim @ 2014-08-03 10:59 UTC (permalink / raw)
  To: 18181

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hello.  I am seeing what I think is a bug in
display-buffer-below-selected in recent versions of emacs-24.3.

Namely, if you execute display-buffer-below-selected when the buffer
is already in a window below selected, you will get *two* windows
showing the buffer.  A simple test is to run

    (let ((buffer (get-buffer-create "test-buffer")))
      (display-buffer-below-selected buffer nil)
      (display-buffer-below-selected buffer nil))

in *scratch*.

This behavior seems to have been introduced in git commit
    6a5d9e9a3247566bf69575444e2a1f75f5b3e021
in the emacs-24 branch of git://git.savannah.gnu.org/emacs.git

-T


[-- Attachment #2.1: Type: text/html, Size: 837 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-03 10:59 bug#18181: bug in display-buffer-below-selected Trevor Jim
@ 2014-08-04 17:22 ` martin rudalics
  2014-08-04 23:58   ` Juri Linkov
  2014-08-04 17:53 ` Trevor Jim
  2014-08-05 14:07 ` Trevor Jim
  2 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2014-08-04 17:22 UTC (permalink / raw)
  To: Trevor Jim, 18181

 > Hello.  I am seeing what I think is a bug in
 > display-buffer-below-selected in recent versions of emacs-24.3.
 >
 > Namely, if you execute display-buffer-below-selected when the buffer
 > is already in a window below selected, you will get *two* windows
 > showing the buffer.  A simple test is to run
 >
 >       (let ((buffer (get-buffer-create "test-buffer")))
 >         (display-buffer-below-selected buffer nil)
 >         (display-buffer-below-selected buffer nil))
 >
 > in *scratch*.

This is the intended behavior.  `display-buffer-at-bottom' and
`display-buffer--maybe-pop-up-frame-or-window' also display the buffer a
second time even if it's already shown.  The correct use of this is to
try `display-buffer-reuse-window' before `display-buffer-below-selected'.

 > This behavior seems to have been introduced in git commit
 >       6a5d9e9a3247566bf69575444e2a1f75f5b3e021
 > in the emacs-24 branch of git://git.savannah.gnu.org/emacs.git

Can you please tell me which commit this was.  I don't have git.

Thanks, martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-03 10:59 bug#18181: bug in display-buffer-below-selected Trevor Jim
  2014-08-04 17:22 ` martin rudalics
@ 2014-08-04 17:53 ` Trevor Jim
  2014-08-05  8:36   ` martin rudalics
  2014-08-05 14:07 ` Trevor Jim
  2 siblings, 1 reply; 9+ messages in thread
From: Trevor Jim @ 2014-08-04 17:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: 18181

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

> This is the intended behavior

OK. Just FYI however, there has been a change in behavior. It's
possible that other software has been affected by the change. For
example, the reason I used display-buffer-below-selected was because I
saw it used in rmail.  You might want to make sure that rmail is still
working correctly.

I'm not sure how it corresponds to bzr but you can see the git commit
here:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6a5d9e9a3247566bf69575444e2a1f75f5b3e021

With that commit I see the new behavior.  Before that commit, all the
way up to 24.3 at least, I see the old behavior.

Also: I have to say that looking at the documentation it is hard to
say what the intended behavior is.

Thanks,
Trevor


[-- Attachment #2.1: Type: text/html, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-04 17:22 ` martin rudalics
@ 2014-08-04 23:58   ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2014-08-04 23:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: Trevor Jim, 18181

>>       (let ((buffer (get-buffer-create "test-buffer")))
>>         (display-buffer-below-selected buffer nil)
>>         (display-buffer-below-selected buffer nil))
>
> This is the intended behavior.  `display-buffer-at-bottom' and
> `display-buffer--maybe-pop-up-frame-or-window' also display the buffer a
> second time even if it's already shown.  The correct use of this is to
> try `display-buffer-reuse-window' before `display-buffer-below-selected'.

I agree that `display-buffer-below-selected' should be prepended by
`display-buffer-reuse-window' in the list of display actions
when there is a need to reuse an already displayed window like

  (let ((buffer (get-buffer-create "test-buffer")))
    (display-buffer buffer `((display-buffer-reuse-window
                              display-buffer-below-selected)))
    (display-buffer buffer `((display-buffer-reuse-window
                              display-buffer-below-selected))))

>> This behavior seems to have been introduced in git commit
>>       6a5d9e9a3247566bf69575444e2a1f75f5b3e021
>> in the emacs-24 branch of git://git.savannah.gnu.org/emacs.git
>
> Can you please tell me which commit this was.  I don't have git.

It's bzr revno 115543 from our discussion at bug#16115
that removed the need to add `(split-height-threshold 0)'
to every use of `display-buffer-below-selected'.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-04 17:53 ` Trevor Jim
@ 2014-08-05  8:36   ` martin rudalics
  0 siblings, 0 replies; 9+ messages in thread
From: martin rudalics @ 2014-08-05  8:36 UTC (permalink / raw)
  To: Trevor Jim; +Cc: 18181

 >> This is the intended behavior
 >
 > OK.

I'm afraid you don't like it.  But let me explain why it's this way: As
a first step, `display-buffer' usually searches all windows whether the
buffer is already displayed.  This search doesn't come without any cost
because we have to check whether the selected window or another frame
are eligible.  Hence, it makes sense to do that search in the separate
action function `display-buffer-reuse-window'.  Usually, that function
is the very first tried by `display-buffer'.

The remaining action functions have been written based on the idea that
`display-buffer-reuse-window' already failed to find a suitable window
and either a new window or one that doesn't display the buffer already
has to be provided.

 > Just FYI however, there has been a change in behavior. It's possible that other software has been affected by the change. For example, the reason I used display-buffer-below-selected was because I saw it used in rmail.  You might want to make sure that rmail is still working correctly.

Can you elaborate how rmail might be affected by this?

 > I'm not sure how it corresponds to bzr but you can see the git commit here:
 >
 > http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6a5d9e9a3247566bf69575444e2a1f75f5b3e021
 >
 > With that commit I see the new behavior.  Before that commit, all the way up to 24.3 at least, I see the old behavior.

I understand what you mean now.  That indeed changed the behavior for
the "frame has more than one window" case.  Though IIRC its intention
was to handle the case where the buffer is _not_ displayed yet, a fact
`display-buffer-reuse-window' should have implicitly checked before.

 > Also: I have to say that looking at the documentation it is hard to say what the intended behavior is.

As a rule: The idea is that an application should always try
`display-buffer-reuse-window' first unless the intended behavior is to
strictly use a new window or one that displays another buffer.  If you
(or anyone else) have any good ideas how to change the documentation
such that this idea becomes immediately evident, please don't hesitate
to propose the necessary change.  I have not written the present
documentation and my English probably isn't well enough to do the job.

Thanks, martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-03 10:59 bug#18181: bug in display-buffer-below-selected Trevor Jim
  2014-08-04 17:22 ` martin rudalics
  2014-08-04 17:53 ` Trevor Jim
@ 2014-08-05 14:07 ` Trevor Jim
  2014-08-09 17:04   ` martin rudalics
  2 siblings, 1 reply; 9+ messages in thread
From: Trevor Jim @ 2014-08-05 14:07 UTC (permalink / raw)
  To: martin rudalics; +Cc: 18181

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

> I'm afraid you don't like it.

Actually it doesn't matter to me, I've fixed my program to work either way. I am just pointing out the change of behavior in case someone else has been relying on it.

Thanks,
-Trevor

[-- Attachment #2.1: Type: text/html, Size: 323 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-05 14:07 ` Trevor Jim
@ 2014-08-09 17:04   ` martin rudalics
  2014-08-09 23:49     ` Juri Linkov
  2014-08-29 10:47     ` martin rudalics
  0 siblings, 2 replies; 9+ messages in thread
From: martin rudalics @ 2014-08-09 17:04 UTC (permalink / raw)
  To: Trevor Jim; +Cc: 18181

 > Actually it doesn't matter to me, I've fixed my program to work either way. I am
 > just pointing out the change of behavior in case someone else has been relying
 > on it.

In revision#117435 of the emacs-24 branch I restored the old behavior
for the case where the buffer already appears below the selected window.
As soon as you've updated (on trunk this might take a couple of days)
kindly check whether it now behaves as you expected before.

Thanks, martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-09 17:04   ` martin rudalics
@ 2014-08-09 23:49     ` Juri Linkov
  2014-08-29 10:47     ` martin rudalics
  1 sibling, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2014-08-09 23:49 UTC (permalink / raw)
  To: martin rudalics; +Cc: Trevor Jim, 18181

> In revision#117435 of the emacs-24 branch I restored the old behavior
> for the case where the buffer already appears below the selected window.

Maybe the same would be good also for `display-buffer-at-bottom'
to reuse the window already displayed at the bottom?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#18181: bug in display-buffer-below-selected
  2014-08-09 17:04   ` martin rudalics
  2014-08-09 23:49     ` Juri Linkov
@ 2014-08-29 10:47     ` martin rudalics
  1 sibling, 0 replies; 9+ messages in thread
From: martin rudalics @ 2014-08-29 10:47 UTC (permalink / raw)
  To: Trevor Jim; +Cc: 18181-done

 > > In revision#117435 of the emacs-24 branch I restored the old behavior
 > > for the case where the buffer already appears below the selected window.
 >
 > Maybe the same would be good also for `display-buffer-at-bottom'
 > to reuse the window already displayed at the bottom?

Done.  I also now (re-)use the leftmost suitable window at the bottom of
the frame.  Please have a look.  Closing this bug.

Thanks, martin

PS: I apparently never received this mail here and only incidentally
found it now via http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18181.






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-29 10:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-03 10:59 bug#18181: bug in display-buffer-below-selected Trevor Jim
2014-08-04 17:22 ` martin rudalics
2014-08-04 23:58   ` Juri Linkov
2014-08-04 17:53 ` Trevor Jim
2014-08-05  8:36   ` martin rudalics
2014-08-05 14:07 ` Trevor Jim
2014-08-09 17:04   ` martin rudalics
2014-08-09 23:49     ` Juri Linkov
2014-08-29 10:47     ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).