From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "William Payne" Newsgroups: gmane.emacs.help Subject: Re: Is this comment in my .emacs correct? Date: Fri, 20 Aug 2004 18:18:13 +0200 Organization: Island, Linkoping University, Sweden Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <41261839.20804@yahoo.com> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1093018859 19301 80.91.224.253 (20 Aug 2004 16:20:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Aug 2004 16:20:59 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 20 18:20:53 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ByC8K-0005yf-00 for ; Fri, 20 Aug 2004 18:20:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ByCCe-0005rk-4Q for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Aug 2004 12:25:20 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.sunet.se!news01.sunet.se!news.island.liu.se!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: astmatix.ida.liu.se Original-X-Trace: news.island.liu.se 1093018678 2560 130.236.186.15 (20 Aug 2004 16:17:58 GMT) Original-X-Complaints-To: abuse@island.liu.se Original-NNTP-Posting-Date: Fri, 20 Aug 2004 16:17:58 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response Original-Xref: shelby.stanford.edu gnu.emacs.help:124832 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:20181 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:20181 "Kevin Rodgers" wrote in message news:41261839.20804@yahoo.com... > 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 > Thanks for the reply, Kevin. I wanted to make sure I load makefile-mode only when dealing with a file named Makefile and not when the path to the file contained the string Makefile. Your version seems to work, thanks. / WP