unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles
Date: Thu, 21 Sep 2017 06:54:50 -0400	[thread overview]
Message-ID: <20170921105450.rp7a6oucdws3zk6q@logos.localdomain> (raw)
In-Reply-To: <jwvefr0ya1h.fsf-monnier+emacsdiffs@gnu.org>

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	other threads:[~2017-09-21 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170921105450.rp7a6oucdws3zk6q@logos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).