GNU bug report logs - #49932
28.0.50; Error in GUI frames when xterm-set-window-title is set

Previous Next

Package: emacs;

Reported by: Knut Anders Hatlen <kahatlen <at> gmail.com>

Date: Sat, 7 Aug 2021 21:16:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 49932 <at> debbugs.gnu.org (full text, mbox):

From: Knut Anders Hatlen <kahatlen <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49932 <at> debbugs.gnu.org
Subject: Re: bug#49932: 28.0.50; Error in GUI frames when
 xterm-set-window-title is set
Date: Mon, 09 Aug 2021 20:39:25 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Knut Anders Hatlen <kahatlen <at> gmail.com> writes:
>
>> 5. Start a new GUI frame with 'emacsclient -c', and again observe that
>>    "Device 1 is not a termcap terminal device" is reported.
>>
>> I believe xterm-set-window-title should not affect GUI frames.
>
> The problem seems to be:
>
> (defun xterm-set-window-title (&optional terminal)
>   "Set the window title of the Xterm TERMINAL.
> The title is constructed from `frame-title-format'."
>   (send-string-to-terminal
>    (format "\e]2;%s\a" (format-mode-line frame-title-format))
>    terminal))
>
> Debugger entered: nil
>   xterm-set-window-title()
>   xterm--init-frame-title()
>   xterm--init()
>   terminal-init-xterm()
>   tty-run-terminal-initialization(#<frame F11 0x5631310b99f0> nil t)
>   tty-create-frame-with-faces(((client . #<process server <15>>) (environment "_=./$
>   #f(compiled-function (params) #<bytecode -0x1d5fbf53102d34d1>)(((client . #<proce$
>   apply(#f(compiled-function (params) #<bytecode -0x1d5fbf53102d34d1>) ((client . #$
>   frame-creation-function(((client . #<process server <15>>) (environment "_=./li
>
> That is, it's not specifying what terminal to set the title in -- so
> it's set in all terminals, no matter what, all the time?  That is:
>
>   (add-hook 'post-command-hook 'xterm-set-window-title)
>   (add-hook 'minibuffer-exit-hook 'xterm-set-window-title))
>
> Which just seems less than optimal in many ways -- running this from
> post-command-hook seems pretty excessive?  But...
>
> Anyway, I've now just made the function not do anything on graphical
> displays, which should make the problem go away, but perhaps this should
> be implemented a different way?

Thanks for the quick fix, Lars. I guess you're right that it's not
ideal. Some kind of generic set-frame-title mechanism that both
graphical frames and tty frames could hook into sounds better. (I don't
know the code well enough to suggest anything concrete. And I haven't
had xterm-set-window-title enabled long enough to have noticed other
problems with the current approach.)

But in any case your patch seems to fix the immediate problem, so thanks
for that.

-- 
Knut Anders




This bug report was last modified 4 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.