From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.bugs Subject: bug#28340: 26.0.50; xterm frame titles Date: Sun, 03 Sep 2017 17:37:24 -0400 Message-ID: <87h8wjo44r.fsf@holos> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1504474721 30016 195.159.176.226 (3 Sep 2017 21:38:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Sep 2017 21:38:41 +0000 (UTC) To: 28340@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 03 23:38:27 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 ) id 1docas-0006Zw-4F for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Sep 2017 23:38:14 +0200 Original-Received: from localhost ([::1]:56134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1docaz-0000vY-5O for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Sep 2017 17:38:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1docal-0000uS-Bn for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:38:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1docag-0001Fi-PZ for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:38:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38302) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1docag-0001FZ-LO for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1docaf-0008HT-UU for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark Oteiza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Sep 2017 21:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28340 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150447467131807 (code B ref -1); Sun, 03 Sep 2017 21:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Sep 2017 21:37:51 +0000 Original-Received: from localhost ([127.0.0.1]:46983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1docaV-0008Gx-AB for submit@debbugs.gnu.org; Sun, 03 Sep 2017 17:37:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1docaS-0008Gj-HP for submit@debbugs.gnu.org; Sun, 03 Sep 2017 17:37:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1docaI-00017Q-9A for submit@debbugs.gnu.org; Sun, 03 Sep 2017 17:37:42 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:46436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1docaI-00017J-5M for submit@debbugs.gnu.org; Sun, 03 Sep 2017 17:37:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1docaD-0000pN-9I for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:37:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doca8-00013P-KT for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:37:33 -0400 Original-Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:35510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1doca8-00012B-FB for bug-gnu-emacs@gnu.org; Sun, 03 Sep 2017 17:37:28 -0400 Original-Received: by mail-qk0-x231.google.com with SMTP id p67so16533617qkd.2 for ; Sun, 03 Sep 2017 14:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=3kCh7BcrzwMP7JWLMs5fcHzSEvLE5EROLhkHRLusjXs=; b=dsyP/8vVQFQZrGv4bIHzPLlJTMOH4iJdVJgr57Iu+Gjb8vR59uY9qFkVZAjQiGUWtu 9x1PjJnZEmhctmiTnPYiznIzgtjKPREm/enS6tHLwE1gWSrKyXom2gWDB95svn9sfDlB GSs3EjPRXzNrBDw+U7OAsgEkL93NIpPeBwJzxpxLJi/68piLlTWzotLD/TnwHdhOeBI3 LOLGLLeWLKpDBEWsgDQGoraZeMqf885XUWnE8dzM0B3ilde6bMmqrQ7a7DH8zr7sT/zz Hi0OBuf+OGL8GVnrRnpFBVwopcl9k6yQme7HRTdG4W2sOO1EwOJZFAoL60mnGan7OPIz AW/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=3kCh7BcrzwMP7JWLMs5fcHzSEvLE5EROLhkHRLusjXs=; b=Pgtlp3DWzv15oZ7KoqoNJJsyUo2Fj/08Y39PlHbjJrAzs3B4+VwviDBfDDpH7GqNpJ BxVQWUfT0iGY3rEH/gTGSLNNAn8MajUNb7Qbu+hDOETEa9DyNL5Wzv8+pONs/3S8J4yQ tRzRbs3zVkFlwtX9dG1gm6CmK8HYrOjr54U1ZDOKX8vhv5zsPsl2XEM8KzjOwMWmwxG0 ayKGnsMlR62nVApICoJALax2ulYVSkbJhItb8fHY7QsGyXjfjQKTCsj9Zo4N5sxAjKb6 GnqxeBsTXBVxM/JDkcJbYdKXLL6kc2QH88UP3y+BWKaO/a6jehCYUh6Sdga3EplvpPx2 5dzQ== X-Gm-Message-State: AHPjjUjHjJF4lIufcpiYmFhher52z6uiPwh7lTSziJcnGdA2Tgp0TYMV EI9mo5iFnqZTN1kC6hmXSg== X-Google-Smtp-Source: ADKCNb4GuKMy7i6oCrMmBbbsxFYE4go69ebk5/t1Ar4/MyMl3YYr52YOwgM2vq7NbuPFQpfrQzCTCw== X-Received: by 10.55.70.75 with SMTP id t72mr10965435qka.14.1504474646359; Sun, 03 Sep 2017 14:37:26 -0700 (PDT) Original-Received: from holos.localdomain (pool-173-64-88-95.bltmmd.fios.verizon.net. [173.64.88.95]) by smtp.gmail.com with ESMTPSA id j129sm2756419qkd.92.2017.09.03.14.37.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Sep 2017 14:37:25 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id AC46666207; Sun, 3 Sep 2017 17:37:24 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136557 Archived-At: Wishlist item. Hi, I tacked setting window/iconified window titles into term/xterm.el, but found a quirk I suspect is related to Bug#18137 (which refers to 42fe2e88d and Bug#15025). Because clients don't always have focus, opening a new client won't trigger hooks that I would think trigger, perhaps even after-make-frame-functions or window-size-change-functions. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index e6d224dd3d..03dd516ebf 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -802,6 +802,7 @@ terminal-init-xterm (when (memq 'setSelection xterm-extra-capabilities) (xterm--init-activate-set-selection))) + (xterm--init-frame-title) ;; Unconditionally enable bracketed paste mode: terminals that don't ;; support it just ignore the sequence. (xterm--init-bracketed-paste-mode) @@ -828,6 +829,22 @@ xterm--init-activate-set-selection "Terminal initialization for `gui-set-selection'." (set-terminal-parameter nil 'xterm--set-selection t)) +(defun xterm--init-frame-title () + "Terminal initialization for `gui-set-selection'." + (xterm-set-window-title) + (add-hook 'post-command-hook 'xterm-set-window-title) + (add-hook 'minibuffer-exit-hook 'xterm-set-window-title)) + +(defun xterm-set-window-title () + "Set the window title of the Xterm with the current Emacs frame." + (send-string-to-terminal + (format "\e]2;%s\a" (format-mode-line frame-title-format)))) + +(defun xterm-set-icon-title () + "Set the window title of the Xterm with the current Emacs frame." + (send-string-to-terminal + (format "\e]1;%s\a" (format-mode-line icon-title-format)))) + (defun xterm--selection-char (type) (pcase type ('PRIMARY "p")