bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature request: efficient support for dynamic GNU Screen window titles


From: Trent Buck
Subject: feature request: efficient support for dynamic GNU Screen window titles
Date: Sun, 29 Apr 2007 04:45:37 +1000
User-agent: Mutt/1.5.13 (2006-08-11)

[I'm currently using CVS GNU Emacs; I'm not using emacs-pretest-bug
because it's not release critical.  I hope that's the Right Thing.]

I use GNU Screen as both a window system and a window manager.  Screen
allows client windows to change their window title by emitting a
specially crafted escape sequence, like so:

  (send-string-to-terminal
   (concat "\ek"
           (format-mode-line frame-title-format)
           "\e\\"))

I found that the following can be used to update the window title:

  (when (and (null window-system)
             (string-match "\\`screen" (getenv "TERM")))
    (add-hook 'post-command-hook
      (lambda ()
        (send-string-to-terminal
         (concat "\ek"
                 (format-mode-line frame-title-format)
                 "\e\\")))))

Unfortunately, this means that every time ANY command is run, Emacs
prints a string to the controlling terminal.  For example, with the
above hook in place, copying a paragraph of text from another Screen
window into Emacs' window is significantly slower and produces lots of
flicker.  On my 1.6GHz Sempron system, it's UNUSABLY slow.

From [0] and [1], it appears that there is no more appropriate hook.
The analogous code for setting the X window title is implemented in C,
in xdisp.c (x_consider_frame_title).

Is it possible to implement efficient updating of the Screen window
title in lisp (i.e. in my .emacs)?  If not, the C core will need
patching to support this (right?), and I don't speak C.

PS: I also tried using the :eval feature:

  (setq frame-title-format
        '(:eval (progn (shell-command "touch /tmp/zappo")
                       (send-string-to-terminal
                        (concat "\ek"
                                (format-mode-line "%b")
                                "\e\\"))
                       "%b")))

...but this didn't seem to have any effect whatsoever, possibly
because frame-title-format is currently only used when Emacs is
compiled with X support (#ifdef HAVE_WINDOW_SYSTEM).  (The
shell-command form is a kludgy way of determining if the form is ever
evaluated.)

[0] http://lists.gnu.org/archive/html/emacs-devel/2006-03/msg00909.html
[1] http://groups.google.com/group/gnu.emacs.bug/msg/d578877c3a084d84

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]