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: Trent Buck
Subject: Re: feature request: efficient support for dynamic GNU Screen window titles
Date: Mon, 30 Apr 2007 15:45:26 +1000
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, Apr 30, 2007 at 09:04:38AM +0900, Miles Bader wrote:
> "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).

Ah, thank you, this is much better.  I tried timing a sample pasting
of 4096 characters, and the results were:

    No hook:   3 seconds
    New hook:  3 seconds
    Old hook: 21 seconds

...so I'll use this pragmatic version, inelegance of postcommand-hook
be damned.
-- 
Trent Buck, Student Errant

Attachment: signature.asc
Description: Digital signature


reply via email to

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