Luc Teirlinck <[EMAIL PROTECTED]> writes:

> Lute Kamstra wrote:
>
>    It is a problem in combination with a global minor mode defined with
>    define-global-minor-mode since this change:
>
>    2005-05-22  Luc Teirlinck  <[EMAIL PROTECTED]>
>
>          * emacs-lisp/easy-mmode.el (define-global-minor-mode): Use
>          `after-change-major-mode-hook' instead of `find-file-hook'.
>
>    See another message of mine in this thread.
>
> I guess `define-global-minor-mode' could use both
> `after-change-major-mode-hook' and `find-file-hook', although unless
> special care is taken, that could mean that the hook function is run
> twice.

As I understand it, only the first call of GLOBAL-MODE-buffers will
have effect, because it clears the list variable GLOBAL-MODE-buffers.
after-change-major-mode-hook is run before find-file-hook.  If
after-change-major-mode-hook is run too early, that can have negative
effects.  In the case of global-font-lock-mode, calling
global-font-lock-mode-buffers before setting font-lock-defaults is a
problem.

> But that would not eliminate the need for modes to run
> `after-change-major-mode-hook' at their end.  The code before I
> changed it failed if the mode was run from a timer or by a process.
>
> The fallback for modes that do not use `after-change-major-mode-hook'
> yet is post-command-hook.  Even without `after-change-major-mode-hook'
> things should work out OK if you do `M-x org-mode' or visit a file
> with `C-x C-f'.  I believe that the only problems should be modes run
> from timers or processes.

You seem only to consider the problem that GLOBAL-MODE-buffers is not
called.  It can also be a problem when it is called too early.

Lute.


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

Reply via email to