From: Kai Grossjohann <kai@emptydomain.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Some questions of a newbie
Date: Mon, 23 Apr 2007 14:37:39 +0200 [thread overview]
Message-ID: <86647nnu5o.fsf@ketchup.de.uu.net> (raw)
In-Reply-To: 46288bfb$0$337$e4fe514c@news.xs4all.nl
Cecil Westerhof <dummy@dummy.nl> writes:
> I added org-mode and nxml-mode.
> The first uses:
> (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
> the second uses:
> (setq auto-mode-alist
> (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
> auto-mode-alist))
>
> Is there a reason for this, or is it just what the creator liked? If the
> second is the reason, then I prefer the first way and will change the way
> of nxml.
It is a matter of style and taste. I prefer to use add-to-list over
the setq-cons combination because it creates simpler-looking code.
(add-to-list also checks if the entry is already present, the
setq-cons combination shown there might add dupes.)
However, the two variants also differ in that the former uses $ and
the latter uses \\'. $ matches at end of line or end of string,
whereas \\' only matches at end of string.
So if you had a file named foo.org\nbla where \n stands for a newline
character, then the regex "\\.org$" would match. "\\.org\\'" wouldn't
match.
Since file names with newlines in them are rare, this difference has
little practical relevance. Yet, I can't resist to use \\' just
because it's *right* :-)
Kai
next prev parent reply other threads:[~2007-04-23 12:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-20 9:46 Some questions of a newbie Cecil Westerhof
2007-04-20 16:24 ` Eric Hanchrow
2007-04-20 16:26 ` Rjjd
2007-04-20 21:35 ` Matthew Flaschen
2007-04-20 21:38 ` Matthew Flaschen
2007-04-20 21:42 ` Cecil Westerhof
2007-04-21 13:15 ` Johan Bockgård
2007-04-22 11:31 ` Cecil Westerhof
2007-04-22 13:35 ` Johan Bockgård
2007-04-23 10:01 ` Cecil Westerhof
[not found] ` <mailman.2320.1177087525.7795.help-gnu-emacs@gnu.org>
2007-04-20 22:03 ` Cecil Westerhof
2007-04-21 2:26 ` Matthew Flaschen
[not found] ` <mailman.2344.1177122723.7795.help-gnu-emacs@gnu.org>
2007-04-21 7:55 ` Cecil Westerhof
2007-04-21 8:18 ` Joost Kremers
2007-04-21 10:29 ` Cecil Westerhof
2007-04-25 5:07 ` Stefan Monnier
2007-04-25 6:58 ` Cecil Westerhof
2007-04-23 12:37 ` Kai Grossjohann [this message]
2007-04-27 15:11 ` Karl Hegbloom
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=86647nnu5o.fsf@ketchup.de.uu.net \
--to=kai@emptydomain.de \
--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.
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).