help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modify .emacs


From: Tim X
Subject: Re: modify .emacs
Date: Thu, 19 May 2005 08:21:39 +1000
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 17.05.2005 um 14:55 schrieb Michael Dewar:
>
>
> than one cons to auto-mode-alist you can merge them together. It was
> said on this list that \\' is a more precise description of a file
> name's end than $. When using more excessively the regular expressions
> the code can become very hard to understand:
>
> (setq auto-mode-alist
>    (append
>     '(("\\.\\(xsl\\|id\\[de\\]\\)\\'"                 . sgml-mode)
>       ("\\.\\(plist\\|xml\\|xsl\\|fo\\)\\'"           . xml-mode)
>       ("\\.\\(tgz\\|tar\\.\\(bz2\\|gz\\|Z\\)\\)\\'"   . tar-mode)
>       ("\\.\\(arc\\|jar\\|lzh\\|zip\\|zoo\\)\\'"      . tar-mode)
>     auto-mode-alist)))
>
Unless I'm missing something, the \\ doesn't have anything to do with
the end of a word - in the RE above, the \\ at the end of literal
atoms is introducing 'special' characters i.e. \\| indicates an
alternative and \\(...\\) a grouping which allows you to reference
parts of the match with $1, $2 etc. The $ matches the end of the
string your trying to match and is as far as I know the best and only
way to match the end of a string.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]