* Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
@ 2015-01-26 11:28 Joost Kremers
2015-01-26 13:51 ` Dmitry Gutov
0 siblings, 1 reply; 9+ messages in thread
From: Joost Kremers @ 2015-01-26 11:28 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
I'm running into a strange problem that I cannot explain. I'm trying to
add some font-lock keywords through a minor mode.[1] I activate the
minor mode by putting it in the hook of a particular major mode, and the
minor mode activation function calls font-lock-add-keywords with the
proper arguments.
Everything works fine if I call the major mode function interactively
(`M-x markdown-mode', to be precise). The minor mode is activated and
the font-lock keywords are added correctly.
However, if `markdown-mode' is activated through `auto-font-alist', the
additional font-lock keywords are not added.
More precisely, they seem to be added and immediately removed again.
This at least is suggested by my debug efforts: I've added some code to
the function that activates the additional font-lock keywords that saves
the buffer-local value of font-lock-keywords to another variable. When I
check this variable's value after loading a markdown file, the
additional keywords are there. Checking the value of
`font-lock-keywords' at this point shows that the additional keywords
are not there (anymore).
I tried to see if there's anything in my init file that interferes, but
that doesn't seem to be the case. The problem still occurs, even if I
reduce my init file to the following:
,----
| (load-library "/path/to/markdown-mode")
| (load-library "/path/to/pandoc-mode")
| (add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
| (add-hook 'markdown-mode-hook 'pandoc-mode)
`----
Does anyone have an idea where I should look further to debug this
issue? I looked at the code for `set-auto-mode', but couldn't find
anything suspicious...
TIA
Joost
[1] In particular, pandoc-mode:
https://github.com/joostkremers/pandoc-mode
The code adding the font-lock keywords is here:
https://github.com/gbgar/pandoc-mode/commit/a66726170e8db5928e6778f671b4ccfe663a5379
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
2015-01-26 11:28 Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist Joost Kremers
@ 2015-01-26 13:51 ` Dmitry Gutov
2015-01-26 15:13 ` Michael Heerdegen
[not found] ` <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Gutov @ 2015-01-26 13:51 UTC (permalink / raw)
To: Joost Kremers, help-gnu-emacs
On 01/26/2015 01:28 PM, Joost Kremers wrote:
> Everything works fine if I call the major mode function interactively
> (`M-x markdown-mode', to be precise). The minor mode is activated and
> the font-lock keywords are added correctly.
>
> However, if `markdown-mode' is activated through `auto-font-alist', the
> additional font-lock keywords are not added.
I can reproduce this, looks like a bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
2015-01-26 13:51 ` Dmitry Gutov
@ 2015-01-26 15:13 ` Michael Heerdegen
2015-01-26 15:20 ` Dmitry Gutov
[not found] ` <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2015-01-26 15:13 UTC (permalink / raw)
To: help-gnu-emacs
Dmitry Gutov <dgutov@yandex.ru> writes:
> I can reproduce this, looks like a bug.
Could that be another occurrence of the "changing major mode kills all
local variables" thing?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
2015-01-26 15:13 ` Michael Heerdegen
@ 2015-01-26 15:20 ` Dmitry Gutov
2015-01-27 15:57 ` Michael Heerdegen
0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2015-01-26 15:20 UTC (permalink / raw)
To: Michael Heerdegen, help-gnu-emacs
On 01/26/2015 05:13 PM, Michael Heerdegen wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> I can reproduce this, looks like a bug.
>
> Could that be another occurrence of the "changing major mode kills all
> local variables" thing?
Now sure what previous occurrence you're referring to, but killing
happens before the major mode function runs, not after. Right?
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>]
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
[not found] ` <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>
@ 2015-01-26 20:10 ` Stefan Monnier
2015-01-27 20:36 ` Joost Kremers
2015-01-26 20:25 ` Joost Kremers
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-01-26 20:10 UTC (permalink / raw)
To: help-gnu-emacs
>> I can reproduce this, looks like a bug.
> Could that be another occurrence of the "changing major mode kills all
> local variables" thing?
No, it looks more like when global-font-lock-mode's hook runs, it
gets fooled into thinking that the font-lock-keywords was setup for
a parent mode and needs to be re-set.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
2015-01-26 20:10 ` Stefan Monnier
@ 2015-01-27 20:36 ` Joost Kremers
2015-01-27 20:41 ` Dmitry Gutov
0 siblings, 1 reply; 9+ messages in thread
From: Joost Kremers @ 2015-01-27 20:36 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier wrote:
>>> I can reproduce this, looks like a bug.
>> Could that be another occurrence of the "changing major mode kills all
>> local variables" thing?
>
> No, it looks more like when global-font-lock-mode's hook runs, it
> gets fooled into thinking that the font-lock-keywords was setup for
> a parent mode and needs to be re-set.
So should I file a bug report?
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
2015-01-27 20:36 ` Joost Kremers
@ 2015-01-27 20:41 ` Dmitry Gutov
0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2015-01-27 20:41 UTC (permalink / raw)
To: Joost Kremers, help-gnu-emacs
On 01/27/2015 10:36 PM, Joost Kremers wrote:
>> No, it looks more like when global-font-lock-mode's hook runs, it
>> gets fooled into thinking that the font-lock-keywords was setup for
>> a parent mode and needs to be re-set.
>
> So should I file a bug report?
That's usually a good idea.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
[not found] ` <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>
2015-01-26 20:10 ` Stefan Monnier
@ 2015-01-26 20:25 ` Joost Kremers
1 sibling, 0 replies; 9+ messages in thread
From: Joost Kremers @ 2015-01-26 20:25 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> I can reproduce this, looks like a bug.
>
> Could that be another occurrence of the "changing major mode kills all
> local variables" thing?
Well, if it works when `markdown-mode' is called manually (`M-x
markdown-mode'), what is different about activating `markdown-mode'
through `auto-mode-alist'?
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-01-27 20:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-26 11:28 Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist Joost Kremers
2015-01-26 13:51 ` Dmitry Gutov
2015-01-26 15:13 ` Michael Heerdegen
2015-01-26 15:20 ` Dmitry Gutov
2015-01-27 15:57 ` Michael Heerdegen
[not found] ` <mailman.18655.1422285253.1147.help-gnu-emacs@gnu.org>
2015-01-26 20:10 ` Stefan Monnier
2015-01-27 20:36 ` Joost Kremers
2015-01-27 20:41 ` Dmitry Gutov
2015-01-26 20:25 ` Joost Kremers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).