unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Андрей Парамонов" <cmr.pent@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 7368@debbugs.gnu.org
Subject: bug#7368: display-buffer a softly dedicated window
Date: Wed, 17 Nov 2010 21:55:27 +0300	[thread overview]
Message-ID: <AANLkTikasTgH_-X1Oa4n2TW_6GXPruvbxWLvMfbS+DPm@mail.gmail.com> (raw)
In-Reply-To: <4CE40D45.8080004@gmx.at>

2010/11/17 martin rudalics <rudalics@gmx.at>:
>> Do you agree with points 1-6?
>
> If you rewrote them correctly, maybe.

Ok, let's try again ;-)  I completely messed up set-window-buffer and
switch-to-buffer, sorry.

1) In principle, set-window-buffer may fail.

2) set-window-buffer doesn't fail in

(let ((foo (get-buffer-create "foo"))
      (bar (get-buffer-create "bar"))
      (baz (get-buffer-create "baz")))
  (switch-to-buffer foo)
  (delete-other-windows)
  (let ((bar-window (display-buffer bar t)))
    (set-window-dedicated-p bar-window 'soft)
    (set-window-buffer bar-window baz)))

3) display-buffer uses set-window-buffer as a subroutine.

4) display-buffer checks some conditions before calling
set-window-buffer, because the latter may fail.

5) display-buffer fails in

(let ((foo (get-buffer-create "foo"))
      (bar (get-buffer-create "bar"))
      (baz (get-buffer-create "baz")))
  (switch-to-buffer foo)
  (delete-other-windows)
  (let ((bar-window (display-buffer bar t)))
    (set-window-dedicated-p bar-window 'soft))
  (display-buffer baz t))

6) This is because checks in display-buffer before calling
set-window-buffer and inside set-window-buffer are different.

7) I believe this is not logical and should be fixed.

8) I think there is an easy way to fix it by checking for dedicated =
t instead of dedicated != nil inside get-lru-window and
get-largest-window (by the way, is there any chance those are
implemented in Lisp?).

2010/11/17 martin rudalics <rudalics@gmx.at>:
> If the window is dedicated for the sole purpose to make it disappear
> when it's no more need I tend to agree.  There are better solutions.

Please tell which.

> But if an application is allowed to display another buffer _while the
> completions window is shown_ it would be a bad idea to use the
> completions window.

The minibuffer.el 's completion mechanism does not impose any
restrictions on what you can do while *Completions* is visible. That's
slightly off-topic, but I think it allows more user freedom and
clearer code.

> The _only_ purpose of weakly dedicated windows is to not allow
> `display-buffer' to use them.

I disagree. As a matter of fact, weakly dedicated windows possess
another property: they are deleted when their buffer is killed.

As a matter of personal opinion, "not allow `display-buffer' to use
them, but allow `set-window-buffer' to use them" is very hard concept
to understand. Especially given that `display-buffer' uses
`set-window-buffer' inside ;-) Even harder to understand is the
distinction between weakly and truly dedication.

I think that the following is much easier to grasp (although that's
not the primary goal):

1) Weakly dedicated: auto-closes when it's buffer is closed.

2) Truly dedicated: cannot display another buffer, auto-closes when
it's buffer is closed.

> What else would they be good for after
> your "fix"?  And what would you do if someone made completion windows
> strongly dedicated to their buffer?

I do not know. But thinking a bit, completion windows would be
"persistent" (would not disappear until you kill it explicitly). I can
imagine it might be not useless.

However I personally wouldn't make them strongly dedicated and
wouldn't advice to do so.

> IIUC the sequence of events is
>
> (1) the application issues a call for getting the name of a buffer,
>
> (2) the user enters the name with the assistance of the completion
>    routines,
>
> (3) the completion routines return the name,
>
> (4) the caller displays the buffer with that name.
>

No. The command showing *Completions* and command calling
display-buffer are totally unrelated. See the first message.

Best wishes,
Andrey Paramonov





  reply	other threads:[~2010-11-17 18:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 21:59 bug#7368: 23.2; Python interpreter buffer should never appear in separate frame Andrey Paramonov
2010-11-13  6:36 ` bug#7368: Testcase Андрей Парамонов
2010-11-13  8:32   ` martin rudalics
2010-11-13  8:47     ` Андрей Парамонов
2010-11-13  9:55       ` martin rudalics
2010-11-15 22:42       ` Stefan Monnier
2010-11-16 20:19         ` Андрей Парамонов
2010-11-16 21:25           ` Stefan Monnier
2010-11-17  9:46           ` martin rudalics
2010-11-17  8:57 ` bug#7368: display-buffer a softly dedicated window Андрей Парамонов
2010-11-17  9:46   ` martin rudalics
2010-11-17  9:58     ` Андрей Парамонов
2010-11-17 14:16       ` martin rudalics
2010-11-17 15:09         ` Андрей Парамонов
2010-11-17 17:13           ` martin rudalics
2010-11-17 18:55             ` Андрей Парамонов [this message]
2010-11-18  8:03               ` martin rudalics
2010-11-18  8:32                 ` Андрей Парамонов
2010-11-18  9:07                   ` martin rudalics
2010-11-18  9:40                     ` Андрей Парамонов
2010-11-18 10:27                       ` martin rudalics
2010-11-18 10:36                         ` Андрей Парамонов
2010-11-18 13:20                           ` martin rudalics
2010-11-19  6:30                             ` Андрей Парамонов
2011-07-13  2:07                               ` Glenn Morris
2011-07-13  6:24                                 ` martin rudalics
2011-07-13  6:45                                   ` Glenn Morris
2011-07-13  8:37                                     ` martin rudalics
2011-07-13 16:07                                       ` Glenn Morris
2014-12-25 10:55                                         ` martin rudalics
2010-11-18 14:18                   ` Stefan Monnier
2010-11-17 13:10   ` Stefan Monnier
2010-11-18 20:56     ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikasTgH_-X1Oa4n2TW_6GXPruvbxWLvMfbS+DPm@mail.gmail.com \
    --to=cmr.pent@gmail.com \
    --cc=7368@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).