Subject: Re: bug#6280: 24.0.50; (elisp) Dedicated Windows

From: martin rudalics <[email-masked]>
Date: Fri, 28 May 2010 17:10:13 +0200

> So I guess you are trying to point out a conflict that can arise: in _some_
 > cases an application might override a user's directive to make some window
 > dedicated. Is that your point?

No, and I even don't have a point here.  I just wanted to explain how
ECB handles what might be the OP's dilemma.

 > If so:
[...]
 > And that simple user task needs to be better documented.

I doubt that this is a simple user task ...

 >  The important point - the point of the bug, is that a
 > fairly common user task is not adequately documented.

... or a fairly common one.

 >> Suppose you are in a help buffer and want to follow a cross
 >> reference to an Elisp source code buffer.  IIRC this usually
 >> calls `pop-to-buffer'. Now should this action allow `display-buffer'
 >> to "steal" a window showing another Elisp buffer?
 >
 > Not sure how that is relevant. Perhaps you are repeating your point above.

No.  I tried to give a simple example demonstrating that handling
dedicated windows is not simple.

 > Unlike you, I am not trying to redesign Emacs in a bug thread. This bug is about
 > better documenting for users the _existing_ feature that you _can_ dedicate a
 > window to a buffer. That's not sufficiently clear in the doc.

Dedicated windows have an entire section in the Elisp manual.  What is
not sufficiently clear there?

 > Please do not confuse your personal interests and knowledge about this topic
 > with those of a newbie user. This is not about you or how to best design the
 > complex interaction of various possibly conflicting directives to Emacs to
 > display buffers in windows. This is about conveying the simple knowledge that
 > most non-newbies have about dedicated windows to newbies.

We have to disagree on one simple fact: You consider dedicating windows
to buffers a simple task that requires only simple knowledge.  I don't.

 > Does it not do what the OP requested, when you try it? Does it not dedicate the
 > windows for buffers that are in `emacs-lisp-mode'? Do you "_completely_ fail to
 > understand" that it does what the OP asked?

Suppose I have a window showing a buffer in `emacs-lisp-mode' and I
split that window.  Then the new window obviosuly should be dedicated to
that buffer as well.  I fail to understand how you achieve that.

 >> Also, making `special-display-regexps' buffer-local doesn't
 >> make sense to me.  At the time `display-buffer' is called
 >> _any_ buffer may be current.
 >
 > So what? Provided that the function that makes the variable local is called when
 > the correct buffer is current, the variable is made buffer-local in the buffer
 > in question, i.e. in a buffer in the OP's mode.
 >
 > Whether that is the right function to use and the hook is run at the proper time
 > is another question. I think it is, but even if I'm mistaken about that, the
 > point is that you _can_ make `special-display-regexps' local for a buffer that's
 > in the mode you want, and doing that will make buffers in that mode display in
 > dedicated windows.

The fact that you can make a variable buffer-local doesn't imply that it
makes sense to do so.  Making `special-display-regexps' buffer-local
doesn't make sense, IMHO.

 > I do not claim that the function I gave is the right one to document. The point
 > is that we should document this simple user task - tell users that they _can_ do
 > it and, if simple, show them _how_ to do it.
[...]
 > Fine. But please keep in mind the aim of the bug report and, more importantly,
 > the OP's aim. He wants to have the buffers in mode X use dedicated windows.

I earlier mentioned how you can do what the OP wants.  Write a function
that you _globally_ add to `window-configuration-change-hook'.  That
function would have to scan `window-list', check for each window whether
its buffer is in a mode that shall have dedicated windows, and, if that
is the case, call `set-window-dedicated-p' for that window with some
non-nil, non-t flag.  If someone can come up with a simpler solution
I'll be all ears.

martin