all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: auto-mode-alist - recognize prefix instead of sufix?
Date: Thu, 20 Mar 2008 20:18:32 -0600	[thread overview]
Message-ID: <frv5tn$13p$1@ger.gmane.org> (raw)
In-Reply-To: <47E1A5D1.7030902@gmail.com>

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	other threads:[~2008-03-21  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 23:07 auto-mode-alist - recognize prefix instead of sufix? Christian Herenz
2008-03-19 23:46 ` Lennart Borgman (gmail)
2008-03-21  2:18   ` Kevin Rodgers [this message]
     [not found]   ` <mailman.9283.1206065927.18990.help-gnu-emacs@gnu.org>
2008-03-22 15:49     ` Christian Herenz
2008-03-22 15:57       ` Le TeXnicien de Surface
2008-03-22 16:27         ` Christian Herenz

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='frv5tn$13p$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --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.