[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this comment in my .emacs correct?
From: |
Kevin Rodgers |
Subject: |
Re: Is this comment in my .emacs correct? |
Date: |
Fri, 20 Aug 2004 09:26:50 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
William Payne wrote:
> From my .emacs-file:
>
> (setq auto-mode-alist
> (append
> (list
> ; Must use Makefile$ and not just Makefile or you will get makefile mode for
> any
> ; type of file in a directory with the string makefile in it
> '("\\Makefile$" . makefile-mode) )
> auto-mode-alist
> )
> )
>
> Is the comment correct?
Almost. You do need to anchor the "Makefile" string, because the
auto-mode-alist entries are matched against the entire file name
(`C-h v buffer-file-name' for an example). But "$" is not the best
anchor, because it can also match a newline in the path; that's an
admittedly unusual case, but it'd be better and consistent with the
other entries if you used "\\'". Also, you might want to anchor the
beginning of the file name; but the default entries don't provide much
guidance since there are examples with no anchor, some with just "/",
and some with "\\(/\\|\\`\\)".
(setq auto-mode-alist
(cons '("\\(\\`\\|/\\)Makefile\\'" . makefile-mode)
auto-mode-alist))
--
Kevin Rodgers
Re: Is this comment in my .emacs correct?, maddog, 2004/08/20
Re: Is this comment in my .emacs correct?,
Kevin Rodgers <=