Subject: bug#11434: 24.0.96; Determining major mode for a given file extension

From: Reuben Thomas <[email-masked]>
Date: Tue, 8 May 2012 19:30:40 +0100

On 8 May 2012 19:24, Stefan Monnier <[email-masked]> wrote:
>>> For now, I propose to rename it
>>> "*coffee-compiled*.js", but I'd appreciate suggestions as to how I could
>>> do this better. It would be nice to be able to give set-auto-mode a
>>> clue, in the form of a filename or an interpreter name, for cases like this.
>
>> Since it's the file name, not the buffer name, that matters, my
>> current solution is to do:
>
>>   (setq buffer-file-name "compiled.js")
>>   (set-auto-mode)
>>   (setq buffer-file-name nil)
>
>> Does that seem reasonable?
>
> I'd use (let ((buffer-file-name "foo.js")) (set-auto-mode)) instead.

So it's just my Lisp that's bad, not my approach? :)

-- 
http://rrt.sc3d.org