[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1744: bug-reference-mode doesn't fontify when called from mode hook
From: |
Glenn Morris |
Subject: |
bug#1744: bug-reference-mode doesn't fontify when called from mode hook |
Date: |
Thu, 08 Jan 2009 20:48:28 -0500 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Juri Linkov wrote:
> (add-hook 'change-log-mode-hook 'bug-reference-mode)
>
> and a file local variable `bug-reference-url-format'
> in the ChangeLog file:
[...]
> bug references never get fontified because `bug-reference-mode' tests
> whether a variable `bug-reference-url-format' is non-nil before calling
> `(jit-lock-register #'bug-reference-fontify)' in `bug-reference-mode',
> and this variable is not yet set because it gets initialized later
> in `hack-local-variables' called after `set-auto-mode' in `normal-mode'.
This reminds me a bit of bug#347. How about something like this:
*** bug-reference.el 5 Jan 2009 03:23:16 -0000 1.6
--- bug-reference.el 9 Jan 2009 01:47:30 -0000
***************
*** 114,121 ****
""
nil
(if bug-reference-mode
(when bug-reference-url-format
! (jit-lock-register #'bug-reference-fontify))
(jit-lock-unregister #'bug-reference-fontify)
(save-restriction
(widen)
--- 114,125 ----
""
nil
(if bug-reference-mode
+ (progn
+ (let ((enable-local-variables :safe)
+ (enable-local-eval nil))
+ (hack-local-variables))
(when bug-reference-url-format
! (jit-lock-register #'bug-reference-fontify)))
(jit-lock-unregister #'bug-reference-fontify)
(save-restriction
(widen)
- bug#1744: bug-reference-mode doesn't fontify when called from mode hook,
Glenn Morris <=