unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "William Payne" <mikas493_no_spam@student.liu.se>
Subject: Re: Is this comment in my .emacs correct?
Date: Fri, 20 Aug 2004 18:18:13 +0200	[thread overview]
Message-ID: <cg587m$2g0$1@news.island.liu.se> (raw)
In-Reply-To: 41261839.20804@yahoo.com


"Kevin Rodgers" <ihs_4664@yahoo.com> 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 

      reply	other threads:[~2004-08-20 16:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20  0:09 Is this comment in my .emacs correct? William Payne
2004-08-20  0:53 ` Barry Margolin
2004-08-20 16:38   ` Stefan Monnier
2004-08-20 16:59     ` Eli Zaretskii
     [not found]     ` <mailman.2116.1093021754.2011.help-gnu-emacs@gnu.org>
2004-08-20 18:10       ` Stefan Monnier
2004-08-20 18:15         ` Eli Zaretskii
2004-08-20  9:58 ` maddog
2004-08-20 15:26 ` Kevin Rodgers
2004-08-20 16:18   ` William Payne [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='cg587m$2g0$1@news.island.liu.se' \
    --to=mikas493_no_spam@student.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).