all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: why auto-mode-alist's regex ends in \\'
Date: Mon, 07 Jul 2008 21:47:22 -0400	[thread overview]
Message-ID: <barmar-599C7D.21472207072008@newsgroups.comcast.net> (raw)
In-Reply-To: mailman.14358.1215475153.18990.help-gnu-emacs@gnu.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

In article <mailman.14358.1215475153.18990.help-gnu-emacs@gnu.org>,
 "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> wrote:

> Xah wrote:
> > By default, auto-mode-alist has a element:
> > 
> >  ("\\.png\\'" . image-mode)
> > 
> > why is it not the following instead?
> > 
> >  ("\\.png$" . image-mode)
> > 
> > I can't see how file name would end in a “'”, but apparently all
> > regexes there is like that. Emacs's doc node Choosing Modes doesn't
> > seems to explain this.
> > 
> > Thanks.
> > 
> >   Xah
> > ∑ http://xahlee.org/
> 
> See
> 
>    (info "(elisp) Syntax of Regexps")
> 
> \' matches end of string
> $ matches end of line

99.99% of the time either syntax will work in this context.  It can fail 
if you have filenames containing newline -- a file named 
"foo.png<newline>bar" would go into image-mode if the second version 
were used.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


  parent reply	other threads:[~2008-07-08  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 23:22 why auto-mode-alist's regex ends in \\' Xah
2008-07-07 23:58 ` Lennart Borgman (gmail)
     [not found] ` <mailman.14358.1215475153.18990.help-gnu-emacs@gnu.org>
2008-07-08  1:47   ` Barry Margolin [this message]
2008-07-09  0:50   ` Xah

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

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

  git send-email \
    --in-reply-to=barmar-599C7D.21472207072008@newsgroups.comcast.net \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.