[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple runs of menu-bar-update-hook
From: |
Marshall, Simon |
Subject: |
Multiple runs of menu-bar-update-hook |
Date: |
Wed, 26 Jul 2006 16:49:19 +0100 |
I noticed this when debugging something else that I found when trying to
debug a reason for poor Emacs responsiveness. What comes around comes
around - I think I have found a problem that could cause poor
responsiveness.
This is with CVS as of 2006-07-24 with/without Martin's chars_modiff patch.
emacs -Q and evaluate in *scratch*:
(setq bar 0)
(defun foo ()
(message "foo: %s %d" (buffer-name) (setq bar (1+ bar))))
(add-hook 'menu-bar-update-hook 'foo)
Now do a double mouse-1 on the word "message" in *scratch* to select the
word. You can see from the messages in the minibuffer that
menu-bar-update-hook is run twice. I am assuming that menu-bar-update-hook
need not be called to support region-sensitive menu entries, since they can
use an :enable property to achieve that. Should menu-bar-update-hook be
called in this context? Should it be called twice?
Now open multiple frames so there is more than 1 frame showing *scratch*,
and repeat the selection of a word in *scratch*. You can see from the
messages in the minibuffer that menu-bar-update-hook is run twice for each
frame (both *scratch* and non-*scratch* frames). Should it be run multiple
times for each frame?
Now do a single mouse-1 at EOB. Again, menu-bar-update-hook is run twice
for each frame. This happens regardless of the number of frames.
Now do a single mouse-1 anywhere in *scratch*. When there is more than 1
frame showing *scratch*, menu-bar-update-hook is run twice for each frame.
Now do a down mouse-1 anywhere in *scratch* and slowly drag to extend the
region. When there is more than 1 frame and there is more than 1 frame
showing *scratch*, menu-bar-update-hook is run once for each frame for each
character that the region is extended by.
I use msb.el and imenu.el, both of which put their functions on
menu-bar-update-hook, and I frequently use 5+ frames. I know they attempt
to limit the amount of work they do, but I'm sure calling lisp in this way
is going to have an impact.
In GNU Emacs 22.0.50.10 (sparc-sun-solaris2.8, Motif Version 2.1.0)
of 2006-07-26 on perth
X server distributor `Hummingbird Ltd.', version 11.0.100015
configured using `configure
'--prefix=/rvcarma/marshals/software/slash/usr/local'
'--with-x-toolkit=motif' 'CFLAGS=-g''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: en_GB.ISO8859-1
value of $LC_CTYPE: en_GB.ISO8859-1
value of $LC_MESSAGES: C
value of $LC_MONETARY: en_GB.ISO8859-1
value of $LC_NUMERIC: en_GB.ISO8859-1
value of $LC_TIME: en_GB.ISO8859-1
value of $LANG: en_GB.ISO8859-1
locale-coding-system: iso-8859-1
default-enable-multibyte-characters: t
- Multiple runs of menu-bar-update-hook,
Marshall, Simon <=