* Re: feature request: efficient support for dynamic GNU Screen window titles
[not found] <mailman.2697.1177883376.7795.bug-gnu-emacs@gnu.org>
@ 2007-04-30 0:04 ` Miles Bader
2007-04-30 5:45 ` Trent Buck
0 siblings, 1 reply; 3+ messages in thread
From: Miles Bader @ 2007-04-30 0:04 UTC (permalink / raw)
To: trentbuck; +Cc: bug-gnu-emacs
"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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: feature request: efficient support for dynamic GNU Screen window titles
2007-04-30 0:04 ` feature request: efficient support for dynamic GNU Screen window titles Miles Bader
@ 2007-04-30 5:45 ` Trent Buck
0 siblings, 0 replies; 3+ messages in thread
From: Trent Buck @ 2007-04-30 5:45 UTC (permalink / raw)
To: Miles Bader; +Cc: bug-gnu-emacs
[-- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* feature request: efficient support for dynamic GNU Screen window titles
@ 2007-04-28 18:45 Trent Buck
0 siblings, 0 replies; 3+ messages in thread
From: Trent Buck @ 2007-04-28 18:45 UTC (permalink / raw)
To: bug-gnu-emacs; +Cc: trentbuck
[-- Attachment #1.1: Type: text/plain, Size: 2296 bytes --]
[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 #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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-30 5:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2007-04-28 18:45 Trent Buck
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).