Johan Vromans
unread,Jan 6, 2021, 5:21:37 AM1/6/21You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I have a major mode 'joplin-mode' that is derived from 'markdown-mode'. A
Joplin data file is basically a Markdown document with some twists, and
shares the extension '.md'. Whether a document is joplin can be determined
from its content.
What is the proper way to devise this?
One alternative is to add joplin-mode to auto-mode-alist as the handler for
'.md'. When joplin-mode detects that it is not a joplin file it changes the
mode-name back to "Markdown" and the buffer will be handled by the parent
markdown-mode.
Another alternative is to add markdown-mode to auto-mode-alist and add a
hook to markdown-mode-hooks to inspect the contents, and if it is joplin
data then invoke joplin-mode. (Which will invoke markdown-mode so I must
prevent unwanted recursion. That can be solved.)
Is either approach preferred? Or is there an even better way to do it?
Thanks,
Johan