all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles
       [not found] ` <20170920154156.1EB0320923@vcs0.savannah.gnu.org>
@ 2017-09-21  4:02   ` Stefan Monnier
  2017-09-21 10:54     ` Mark Oteiza
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2017-09-21  4:02 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mark Oteiza

> +** 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?


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

* 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

end of thread, other threads:[~2017-09-21 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170920154154.4155.7286@vcs0.savannah.gnu.org>
     [not found] ` <20170920154156.1EB0320923@vcs0.savannah.gnu.org>
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.