Skip to content

Commit

Permalink
Add to beginning of `auto-mode-alist', not end
Browse files Browse the repository at this point in the history
In Emacs 26, a file called 'CHANGELOG.md' will open in
`changelog-mode' instead of `markdown-mode', because a regexp was
added to `auto-mode-alist' that matches the 'CHANGELOG' part of the
filename. In order for the file to correctly open in `markdown-mode',
the regexps for `markdown-mode' must be added earlier in
`auto-mode-alist', hence this commit.

There should be no concern about this overriding user configuration,
since it makes no sense for user configuration code to be run before
the autoloads for `markdown-mode' are evaluated.
  • Loading branch information
raxod502 authored and jrblevin committed Jul 7, 2018
1 parent e45b35b commit b92f00d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
`markdown-font-lock-keywords` is now used instead, but users
should use `font-lock-add-keywords` instead of modifying this
variable.
- `markdown-mode` now adds entries to the beginning of
`auto-mode-alist` rather than the end. If you were relying on
the previous behavior in order to override these entries, you
should fix the problem by following best practice and ensuring
that your user configuration is loaded after the autoloads for
`markdown-mode` are evaluated.

* New features:

Expand Down
4 changes: 2 additions & 2 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -9525,9 +9525,9 @@ spaces, or alternatively a TAB should be used as the separator."
(add-hook 'kill-buffer-hook #'markdown-live-preview-remove-on-kill t t))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode) t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode) t)
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))


;;; GitHub Flavored Markdown Mode ============================================
Expand Down

0 comments on commit b92f00d

Please sign in to comment.