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

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

Re: feature request: efficient support for dynamic GNU Screen window tit


From: Miles Bader
Subject: Re: feature request: efficient support for dynamic GNU Screen window titles
Date: Mon, 30 Apr 2007 09:04:38 +0900

"Trent Buck" <trentbuck@gmail.com> writes:
> 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.

Of course it would be nice to have a more elegant method, but I suspect
your method could be sped up a lot by keeping track of the last string
you sent to the terminal, and only sending again when it changes.

E.g.:

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

This still incurs the overhead of `format-mode-line', but at least it
avoids the actual I/O (which I expect is the main cause of slowness).

-Miles

-- 
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde




reply via email to

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