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

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

Re: auto-mode-alist - recognize prefix instead of sufix?


From: Kevin Rodgers
Subject: Re: auto-mode-alist - recognize prefix instead of sufix?
Date: Thu, 20 Mar 2008 20:18:32 -0600
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

Lennart Borgman (gmail) wrote:
Christian Herenz wrote:
Hi,

is it possible to use a major-mode on files with a certain prefix?
I know that I can do something like this:

(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode)auto-mode-alist))

But what about opening files like foo.comments, foo.examples and so on in a special mode?


I never tried, but from the documentation it looks perfectly possible. Have you tried to use a regexp like "^foo\." ?

It is definitely possible, but the auto-mode-alist regexp is matched
against the whole file name sans backup suffix i.e.
(file-name-sans-version buffer-file-name).

So the regexp should be something like "\\(\\`\\|/\\)foo\.[^/]*\\'"

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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