Mailing List Archive


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

[tlug] [X]Emacs file association (auto-mode)



I know how to tell [X]Emacs about file extensions for automatic mode
association. In my .xemacs/custom.el, I have stuff like:

; cperl-mode:   .cgi
(setq auto-mode-alist (append (list (cons "\\.cgi\\'" 'cperl-mode))
      auto-mode-alist))

This works like a charm. But now I am faced with a new problem, and
want to solve it properly, and not just by manually unrolling a loop
in my init file, so to speak.

Here is what I mean: I am working on a bunch of file templates, which
all have a .m4 extension (can you guess what I am using to process the
templates?). What I would like to do is something like this:

(setq auto-mode-alist (append (list (cons "\\.html\\.m4\\'" 'html-mode))
      auto-mode-alist))

But I don't want to have to add lines like this for each of my N file
extensions. I would rather "strip" the .m4 extension off of the end of
the filename and let auto-mode-alist have at it.

Lisp hackers, can you help? I apologise in advance for not Googling
this out, but my needs are specific enough that I could not devise a
good query.

RTFMs will be happily accepted, provided you give me a line to TFM
that I should R. ;)

TIA,
Josh

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links