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

From: "Drew Adams" <[email-masked]>
Date: Fri, 28 May 2010 09:16:14 -0700

Martin, you are trying to take this bug report far afield.
I won't bother to get into it with you.

I was clear about what is needed for the doc about this topic:

1. Put something in the Emacs manual about how to make windows dedicated.
2. In the Elisp manual, mention `special-display' buffers in node `Dedicated
Windows'.

See the original bug report for details.

When you say things like this, you seem to be playing provocateur:

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

My value of `special-display-regexps' is ("[ ]?[*][^*]+[*]"), so buffers named
`*...*' are special.  That means that most of the time they are in dedicated
windows.

Can I split a `*Help*' window or an `*Info*' window?  Of course.  Is each of the
two windows dedicated to the buffer?  No, only the first (original) one is.  So
what?

Do you want to change all of the doc about special buffers, to make your point?
The doc string of `special-display-regexps' is technically incorrect/incomplete,
since it suggests that displaying such a buffer (with the default
`special-display-function') gives it its own frame.

Should we add a note here, there, and everywhere saying "Martin wants you to
know that this is not strictly true in all cases. Here is the truth (fasten your
seat belt and shoulder harness): ... [3 pages of details about the true
relations between windows and buffers]"?
[** - see below]

This is all beside the point.  What is important is that knowing about the
existence of `special-display-regexps' I am able to have Emacs open such buffers
in their own window and inhibit their replacement in that window.  It is that
knowledge that needs to be better communicated to users.  That's all.

You are up on your soap box and totally missing the point.  It's about the doc.
It's about new users.  It's about making it more obvious that you can dedicate
windows to buffers, that there is a notion of special buffer.  This is not about
the intricacies of special-buffer display.

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

Sigh.

----

** Such a tendency is already underway. Compare the `special-display-regexps'
doc strings for
Emacs 20 and 23, below.  Will the Emacs 26 doc string read only like a legal
disclaimer? Don't get me wrong.  The reference doc should be complete and
correct.  But doc should also help you to see the forest, not just become lost
in the forest litter.

20:

List of regexps saying which buffers should have their own special frames.
If a buffer name matches one of these regexps, it gets its own frame.
Displaying a buffer whose name is in this list makes a special frame for it
using `special-display-function'.

An element of the list can be a list instead of just a string.
There are two ways to use a list as an element:
  (REGEXP FRAME-PARAMETERS...)   (REGEXP FUNCTION OTHER-ARGS...)
In the first case, FRAME-PARAMETERS are used to create the frame.
In the latter case, FUNCTION is called with the buffer as first argument,
followed by OTHER-ARGS--it can display the buffer in any way it likes.
All this is done by the function found in `special-display-function'.

If this variable appears "not to work", because you add a regexp to it
but the matching buffers still appear in the selected window, look at the
values of `same-window-buffer-names' and `same-window-regexps'.
Those variables take precedence over this one.

23:

List of regexps saying which buffers should be displayed specially.
Displaying a buffer with `display-buffer' or `pop-to-buffer', if
any regexp in this list matches its name, displays it specially
using `special-display-function'.  `special-display-popup-frame'
(the default for `special-display-function') usually displays
the buffer in a separate frame made with the parameters specified
by `special-display-frame-alist'.  If `special-display-function'
has been set to some other function, that function is called with
the buffer as first, and nil as second argument.

Alternatively, an element of this list can be specified as
(REGEXP FRAME-PARAMETERS), where REGEXP is a regexp as above and
FRAME-PARAMETERS an alist of (PARAMETER . VALUE) pairs.
`special-display-popup-frame' will then interpret these pairs as
frame parameters when creating a special frame for a buffer whose
name matches REGEXP, overriding the corresponding values from
`special-display-frame-alist'.

As a special case, if FRAME-PARAMETERS contains (same-window . t)
`special-display-popup-frame' displays buffers matching REGEXP in
the selected window.  (same-frame . t) in FRAME-PARAMETERS means
to display such buffers in a window on the selected frame.

If `special-display-function' specifies some other function than
`special-display-popup-frame', that function is called with the
buffer whose name matched REGEXP as first, and FRAME-PARAMETERS
as second argument.

Finally, an element of this list can be also specified as
(REGEXP FUNCTION OTHER-ARGS).  `special-display-popup-frame'
will then call FUNCTION with the buffer whose name matched
REGEXP as first, and OTHER-ARGS as second argument.  If
`special-display-function' specifies some other function, that
function is called with the buffer whose name matched REGEXP
as first, and the element's cdr as second argument.

If this variable appears "not to work", because you added a
name to it but the corresponding buffer is displayed in the
selected window, look at the values of `same-window-buffer-names'
and `same-window-regexps'.  Those variables take precedence over
this one.

See also `special-display-buffer-names'.