emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles


From: Mark Oteiza
Subject: Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles
Date: Thu, 21 Sep 2017 06:54:50 -0400
User-agent: NeoMutt/20170912-13-728bb5

On 21/09/17 at 04:02am, Stefan Monnier wrote:
> > +** Enhanced xterm support
> > +*** New variable 'xterm-set-window-title' controls whether Emacs
> > +sets the XTerm window title.  The default is to set the window title.
> 
> I like this, but I don't like the fact that when I exit the Emacs
> session, the xterm's title is not reset to its previous value.
> Could we fix that part?

Thanks.  The following should work for XTerm, but it appears to be not
supported in other terms (like VTE based ones) that use xterm-FOO terminfo,
which is disappointing.

I think there are many terminal emulators that use xterm-FOO terminfo, so
this default could be troublesome for those users.  I'll have to take
a look at checking supported escapes... otherwise perhaps the default should
change.

and here I thought supporting something in a terminal would be simple :P

diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 6a17d382b0..72d7ff1f45 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -837,12 +837,20 @@ xterm--init-activate-set-selection
 
 (defun xterm--init-frame-title ()
   "Terminal initialization for XTerm frame titles."
+  (xterm-push-title-stack)
   (xterm-set-window-title)
+  (add-hook 'delete-frame-functions 'xterm-pop-title-stack)
   (add-hook 'after-make-frame-functions 'xterm-set-window-title-flag)
   (add-hook 'window-configuration-change-hook 'xterm-unset-window-title-flag)
   (add-hook 'post-command-hook 'xterm-set-window-title)
   (add-hook 'minibuffer-exit-hook 'xterm-set-window-title))
 
+(defun xterm-push-title-stack ()
+  (send-string-to-terminal "\e[22;0t"))
+
+(defun xterm-pop-title-stack (&optional terminal)
+  (send-string-to-terminal "\e[23;0t" terminal))
+
 (defvar xterm-window-title-flag nil
   "Whether a new frame has been created, calling for a title update.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]