unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: 28340@debbugs.gnu.org
Subject: bug#28340: 26.0.50; xterm frame titles
Date: Sun, 03 Sep 2017 17:37:24 -0400	[thread overview]
Message-ID: <87h8wjo44r.fsf@holos> (raw)


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")





             reply	other threads:[~2017-09-03 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 21:37 Mark Oteiza [this message]
2017-09-04  4:16 ` bug#28340: 26.0.50; xterm frame titles Eli Zaretskii
2017-09-12  1:21   ` Mark Oteiza
2017-09-20  7:47     ` Eli Zaretskii
2017-09-20 12:23       ` Mark Oteiza
2017-09-20 13:47         ` Eli Zaretskii
2017-09-20 16:06           ` Mark Oteiza

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=87h8wjo44r.fsf@holos \
    --to=mvoteiza@udel.edu \
    --cc=28340@debbugs.gnu.org \
    /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).