[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-mode and mode hooks.
From: |
Lute Kamstra |
Subject: |
Re: org-mode and mode hooks. |
Date: |
Wed, 25 May 2005 19:01:09 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Luc Teirlinck <address@hidden> 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 <address@hidden>
>
> * 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.
Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/25
Re: org-mode and mode hooks., Richard Stallman, 2005/05/26
Re: org-mode and mode hooks., Juri Linkov, 2005/05/27