Ar an chéad lá is fiche de mí Lúnasa, scríobh Raymond Toy:
On 8/21/10 10:40 AM, Aidan Kehoe wrote:
> Ar an naoú lá déag de mí Lúnasa, scríobh Raymond Toy:
>
> > This shows up in slime where currently slime updates the modeline by
> > scanning every buffer to see if it is in slime-mode and updating the
> > modeline appropriately. When there are a dozen buffers or more,
> > slime drastically slows down.
>
> There isn’t yet. I would be shocked if [it] were absolutely necessary,
> though; does replacing #'slime-recompute-modelines with the below
> (untested, I haven’t used slime much) improve things for you? And yes,
> byte-compilation is the way to go!
[snip code]
This seems to work very well, even without byte-compiling the code.
Thank you very much for this. I'll send it off to the slime guys so
they can incorporate this code into slime.
As I say, I haven’t used slime much, and from looking a bit closer at the
slime code I can imagine my change being irritatingly slow to update
modelines in buffers that have just been displayed, after having been hidden
for some time. If you notice this, please give the below a shot; as well as
updating the modeline with each slime event received, it’ll update the
modeline every time XEmacs has nothing to do (that is, you’ve stopped typing
for five seconds, or whatever.) The older version of the recompute function
was a little readier to force a modeline update, which is not ideal if the
function is to be called from pre-idle-hook.
(defmacro slime-recompute-modelines ()
;; Avoid a needless runtime funcall on GNU Emacs:
(and (featurep 'xemacs) `(slime-xemacs-recompute-modelines)))
(defun slime-xemacs-recompute-modelines ()
(let (redraw-modeline)
(walk-windows
#'(lambda (object)
(setq object (window-buffer object))
(when (or (symbol-value-in-buffer 'slime-mode object)
(symbol-value-in-buffer 'slime-popup-buffer-mode object))
;; Only do the unwind-protect of #'with-current-buffer if we're
;; actually interested in this buffer:
(with-current-buffer object
(setq redraw-modeline
(or (not (equal slime-modeline-string
(setq slime-modeline-string
(slime-modeline-string))))
redraw-modeline)))))
'never 'visible)
(and redraw-modeline (redraw-modeline t))))
(and (featurep 'xemacs)
(pushnew 'slime-xemacs-recompute-modelines pre-idle-hook))
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/mailman/listinfo/xemacs-beta