unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Trent Buck" <trentbuck@gmail.com>
To: Miles Bader <miles@gnu.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: feature request: efficient support for dynamic GNU Screen window titles
Date: Mon, 30 Apr 2007 15:45:26 +1000	[thread overview]
Message-ID: <20070430054526.GA22077@baal.lan> (raw)
In-Reply-To: <87hcqy4tih.fsf@catnip.gol.com>


[-- Attachment #1.1: Type: text/plain, Size: 1632 bytes --]

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 #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

  reply	other threads:[~2007-04-30  5:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2697.1177883376.7795.bug-gnu-emacs@gnu.org>
2007-04-30  0:04 ` feature request: efficient support for dynamic GNU Screen window titles Miles Bader
2007-04-30  5:45   ` Trent Buck [this message]
2007-04-28 18:45 Trent Buck

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=20070430054526.GA22077@baal.lan \
    --to=trentbuck@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=miles@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).