Re: suggested feature -- console-mode frame title sets Xterm title

From:

Martin Pool

Subject:

Re: suggested feature -- console-mode frame title sets Xterm title

Date:

Fri, 3 Oct 2003 11:04:05 +1000

User-agent:

Mutt/1.5.4i

On 2 Oct 2003, Richard Stallman <address@hidden> wrote:
> I think the only remaining problem is that this has changed the way
> select-buffer-by-name works.
>
> I can't find any select-buffer-by-name in the Emacs sources.
> Could you please explain what this is about?
Sorry, I meant select-frame-by-name.
> For multi-frame text terminals the names
> used to be F%d, but now they're "full" names, probably including the
> name of the buffer.
>
> I am confused. What are "the names"?
>From the emacs 21.3 manual:
Non-Window Terminals
====================
If your terminal does not have a window system that Emacs supports,
then it can display only one Emacs frame at a time. However, you can
still create multiple Emacs frames, and switch between them. Switching
frames on these terminals is much like switching between different
window configurations.
Use `C-x 5 2' to create a new frame and switch to it; use `C-x 5 o'
to cycle through the existing frames; use `C-x 5 0' to delete the
current frame.
Each frame has a number to distinguish it. If your terminal can
display only one frame at a time, the selected frame's number N appears
near the beginning of the mode line, in the form `FN'.
`FN' is actually the frame's name. You can also specify a different
name if you wish, and you can select a frame by its name. Use the
command `M-x set-frame-name <RET> NAME <RET>' to specify a new name for
the selected frame, and use `M-x select-frame-by-name <RET> NAME <RET>'
to select a frame according to its name. The name you specify appears
in the mode line when the frame is selected.
Before this patch, on non-window terminals, the f->name field is set
to 'F%d' by default. This identifier also comes up near the left of
the modeline through the mode-line-frame-identification variable and
the '%F' format. This is why when you start "emacs-21.3 -q nw", you
see the string "F1" to the left of the buffer name. (I always
wondered why that was there...)
Also in 21.3, the behaviour on window system frames is quite
different: f->name contains what I think of as a "full name" for the
window. It's produced by expanding the variable frame-title-format.
This is by default "address@hidden" if there is one frame, or the
buffer name if there is more than one. The frame name is usually used
as the window title. You can also use select-frame-by-name here, but
you need to choose a window title, not a short name like "F1".
The problem is that the manual gives the impression that "each frame
has a number to distinguish it", but in fact this is just a different
default frame name.
This patch makes frame-title-format apply to both window and
non-window frames, so the frame titles are consistent between them.
As a side effect it removes the special-case behaviour for frame names
described in that section of the manual. In other words, with my
current version of the patch, the first termcap frame is called
"address@hidden", just as for the first window-system frame.
So the functionality of switching between non window system frames
still works, but the pattern names you choose from are different.
> To avoid messing up the modeline I have disabled the %F character when
> tty-frame-use-title is set.
>
> I am confused here too. What does any of this have to do with
> the mode line? What would have "messed it up"?
The '%F' format item shows the frame name in the modeline, and it is
in there by default on non-window terminals.
With this patch applied, the frame name follows frame-title-format,
which is typically much longer than two characters. This causes the
frame title to use up a lot of the space on the modeline. I say it's
messed up because you might not be able to see, say, the line-number
annunciator.
If the buffer name is in the frame title then it's printed twice, once
by %F and once by %b. This looks messy.
-- mbp