4

I have installed markdown-mode.el as described here. How do I get Emacs (specifically, Aquamacs) to load gfm-mode rather than markdown-mode for .markdown files? In case it's important, the relevant section(s) of my ~/.emacs currently look(s) like this:

(add-to-list 'load-path "~/.emacs.d/")

; Some irrelevant (I think) other stuff

(autoload 'markdown-mode "markdown-mode.el" "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.mdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.mdt\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))

I'm extremely noobish with Emacs in general, so I'd appreciate step-by-step instructions.

Nifle
  • 34,203
  • 26
  • 108
  • 137

1 Answers1

5

Try replacing the lines you posted with these:

(add-to-list 'load-path "~/.emacs.d/")

;;; Markdown mode
(autoload 'gfm-mode "markdown-mode.el" "Major mode for editing Markdown files" t)
(setq auto-mode-alist (cons '("\\.text$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.md$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.mdown$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.mdt$" . gfm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.markdown$" . gfm-mode) auto-mode-alist))

The important thing is to add 'gfm-mode before "markdown-mode.el" in the autoload command.

terdon
  • 52,568
  • 14
  • 124
  • 170
  • That just does the same thing as my current *.emacs*. I wanted it to load gfm-mode rather than markdown-mode. – Ptharien's Flame Feb 17 '13 at 00:35
  • 1
    @Ptharien'sFlame, sorry, I misunderstood your question. It should work now. – terdon Feb 17 '13 at 22:47
  • That doesn't work at all, unless something else entirely is wrong: I get *fill-mode* when I shouldn't, and syntax highlighting in code fences is not active. – Ptharien's Flame Feb 18 '13 at 00:46
  • 1
    @Ptharien'sFlame, that I can't help you with. Perhaps the mode is not what you expect. Does emacs say it is in gfm-mode in the status bar? If yes, then the mode has been successfully loaded. – terdon Feb 18 '13 at 01:03
  • It does say it's in *gfm-mode*, but it behaves like it's in standard `markdown-mode`. I guess you answered my question as stated. – Ptharien's Flame Feb 18 '13 at 01:54