I am trying to set up .emacs so that any file which begins with the letters makefile sets it to makefile mode. E.g. makefile-something should be in makefile mode.
This doesn’t work:
(setq auto-mode-alist (cons '("^makefile" . makefile-mode) auto-mode-alist))
But this does:
(setq auto-mode-alist (cons '("makefile" . makefile-mode) auto-mode-alist))
Can anyone explain why?
It is because there is a path component in front of the filename, try:
see http://www.gnu.org/s/emacs/manual/html_node/elisp/Auto-Major-Mode.html (bottom of page)
EDI: corrected regexp according to Sean comment