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

From: Stefan Monnier <[email-masked]>
Date: Tue, 08 May 2012 14:24:19 -0400

>> 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.

        Stefan