From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza <mvoteiza@udel.edu> Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 3a09343: Teach Emacs to set XTerm window titles Date: Thu, 21 Sep 2017 06:54:50 -0400 Message-ID: <20170921105450.rp7a6oucdws3zk6q@logos.localdomain> References: <20170920154154.4155.7286@vcs0.savannah.gnu.org> <20170920154156.1EB0320923@vcs0.savannah.gnu.org> <jwvefr0ya1h.fsf-monnier+emacsdiffs@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1505991356 30365 195.159.176.226 (21 Sep 2017 10:55:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Sep 2017 10:55:56 +0000 (UTC) User-Agent: NeoMutt/20170912-13-728bb5 Cc: emacs-devel@gnu.org To: Stefan Monnier <monnier@IRO.UMontreal.CA> Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 21 12:55:52 2017 Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org> Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>) id 1duz94-0007cK-Rg for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 12:55:51 +0200 Original-Received: from localhost ([::1]:52884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>) id 1duz9C-00074L-2V for ged-emacs-devel@m.gmane.org; Thu, 21 Sep 2017 06:55:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <mvoteiza@udel.edu>) id 1duz8D-0006n8-7G for emacs-devel@gnu.org; Thu, 21 Sep 2017 06:54:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <mvoteiza@udel.edu>) id 1duz8A-0001In-6h for emacs-devel@gnu.org; Thu, 21 Sep 2017 06:54:57 -0400 Original-Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]:55160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <mvoteiza@udel.edu>) id 1duz8A-0001Hd-11 for emacs-devel@gnu.org; Thu, 21 Sep 2017 06:54:54 -0400 Original-Received: by mail-qk0-x22c.google.com with SMTP id d70so5313973qkc.11 for <emacs-devel@gnu.org>; Thu, 21 Sep 2017 03:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tiDY768+aPdRnFCp5c7lc7S5jCGziaNHoH+pO5rq0Fk=; b=T0QnsXcI6DVDEIUrMW0hqT4SZCFlNGW94m4sIHvrqytPrGVZJrvJ7NWpZYKVVp3loV VVBILct0mdnVolu/cnLmAxzKLsCOMvRKBPoYk0atGpuGQmbCokW4AV+37dBUeAX65SbZ wybN8H55edDeRNnNblMPnuT6hrq4qY0ywBnZV48pXm4mt35lTy4nXrUhzLAb8iYuV4C4 U5bLnlRbwR/LG9U/KaX8nwIA/p2/LhAEn7rdqdOVyK8oxYkDRiFviTa8aSLVOxaZ05zq UxAc/INv9KwhHzm7iOFPjcphsBR+md9MWGIibbc3lZruRZCbZGvK6wyFhHZ5hoq3DYxR mslA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tiDY768+aPdRnFCp5c7lc7S5jCGziaNHoH+pO5rq0Fk=; b=IMhBSslVAXpe6CA+GIS9mTnCl6nKdXSQ3+dL6u/JLbXtifuIilp+gkwWLK/+XGWxOp kyjECQ6ZoLxyHNjPhW6ihjabqnUyGvhqdPHKv1XF5lSEmtCXZi0IHXeOn4Q2/SGLodna H5P1QOrczc+X3A9BUJ6+ZHw3OnA/eaIy77WW2jrZwFocoN0PFP22xuZ8W70iTLIiPXsH /vlmWA1xILdhsdgZAc9UDmepBd0on5Aji0LU1y4ngPbU3+FoNXtbknuWKUtx6TNMBd5E nIDX4g9crf8NKY57r+biz9DMye4YnAJ8rIrv5StcFcHnLBDKaF3cuwvVBjavCSuSyhkQ Kgog== X-Gm-Message-State: AHPjjUhoa6jETF1fF9Ak9ZV+jZkfoaGIF0KtwXHiXFbWqwBv2JJsTKHi j7m3KjaoDeD36Hk7Kx7+VgEh1dYLAyg= X-Google-Smtp-Source: AOwi7QBLxIsmWRtjK2ZatI6RQyTV4afgQylVKULRV9IQFOrLhFLEJH7CYXkEsBjZGP0x9RTTQerzQQ== X-Received: by 10.55.160.140 with SMTP id j134mr2356682qke.274.1505991293101; Thu, 21 Sep 2017 03:54:53 -0700 (PDT) Original-Received: from logos.localdomain (pool-173-67-36-61.bltmmd.fios.verizon.net. [173.67.36.61]) by smtp.gmail.com with ESMTPSA id q49sm757218qta.80.2017.09.21.03.54.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Sep 2017 03:54:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: <jwvefr0ya1h.fsf-monnier+emacsdiffs@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." <emacs-devel.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>, <mailto:emacs-devel-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/archive/html/emacs-devel/> List-Post: <mailto:emacs-devel@gnu.org> List-Help: <mailto:emacs-devel-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>, <mailto:emacs-devel-request@gnu.org?subject=subscribe> Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org> Xref: news.gmane.org gmane.emacs.devel:218625 Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/218625> 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.")