GNU bug report logs -
#16759
CC Mode modes: mode hooks are called twice.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 14 Feb 2014 22:21:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 16759 <at> debbugs.gnu.org (full text, mbox):
>> The cause of this is that there is an invocation of run-mode-hooks
>> generated by the macro define-derived-mode as well as an explicit call to
>> run-mode-hooks which is not at the end of the mode function.
> IIUC, this is because you want to run some C-mode stuff after the hooks.
More specifically, it's always c-update-modeline, AFAICT.
A good solution would be to get rid of it and use something like
(let ((lighters '("/" (c-electric-flag "l")
(c-electric-flag (c-auto-newline "a"))
(c-hungry-delete-key "h")
(subword-mode "w"))))
(setq c-mode-options-format
`(c-electric-flag ,lighters
(c-hungry-delete-key ,lighters)
(subword-mode ,lighters)))
(cond
((memq 'c-mode-options-format mode-line-process) nil)
((equal "" (car-safe mode-line-process))
(push 'c-mode-options-format (cdr mode-line-process)))
(t (setq mode-line-process
`("" c-mode-options-format ,mode-line-process)))))
> A simple solution would be to add :after-hook to define-derived-mode.
> You already did this for define-minor-mode.
> It would be good for symmetry/consistency if nothing else, and seems
> pre-approved:
I wouldn't say pre-approved. But, yes, I guess it'd be OK.
Stefan
This bug report was last modified 9 years and 76 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.