all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist
Date: 26 Jan 2015 11:28:15 GMT	[thread overview]
Message-ID: <slrnmcc96f.bar.joost.m.kremers@j.kremers4.news.arnhem.chello.nl> (raw)

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)


             reply	other threads:[~2015-01-26 11:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 11:28 Joost Kremers [this message]
2015-01-26 13:51 ` Possible bug? font-lock-add-keywords in minor mode and auto-mode-alist 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnmcc96f.bar.joost.m.kremers@j.kremers4.news.arnhem.chello.nl \
    --to=joost.m.kremers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.