* Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles
2017-09-21 4:02 ` [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles Stefan Monnier
@ 2017-09-21 10:54 ` Mark Oteiza
0 siblings, 0 replies; 2+ messages in thread
From: Mark Oteiza @ 2017-09-21 10:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
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.")
^ permalink raw reply related [flat|nested] 2+ messages in thread