emacs-devel
[Top][All Lists]
Advanced

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

Re: Language identification


From: Stefan Monnier
Subject: Re: Language identification
Date: Fri, 28 Aug 2009 10:56:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> OTOH, how often do you see a file containg programming language code and
>> yet without ny extension?
> Extremely frequently.

In what kind of circumstance?

> The great majority that I see are correctly identified by file(1) (I
> believe using libmagic), however, by parsing the shebang.

Oh, so they're executables with a shebang.  That's OK we don't need
`file' for that since we have interpreter-mode-alist.  Emacs should
already DTRT for them.

> There are also cases of multiple extensions, where I've seen (for
> example) foo.c.inc used for C implementation code that is used in
> multiple contexts (perhaps with different behavior according to
> #ifdefs).  This would not be recognized by typical Emacs extension
> parsing since although it matches something like "\.c\>", it doesn't
> match the more usual idioms of "\.c$" or "\.c\'".

I've had

  (setq auto-mode-alist (append auto-mode-alist '(("\\.[^/.]+\\'" ignore t))))

in my .emacs for eons to cover such cases.


        Stefan




reply via email to

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