help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: select 'mode' from command line?


From: Stefan Monnier
Subject: Re: select 'mode' from command line?
Date: Fri, 01 Jul 2005 23:23:03 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I'm working witha code that has both fortran 77 and fortran 90 parts. All the 
> files, however, are named *.f, and emacs always opens them with the 'fortran 
> mode', which is actually more fortran77. So, I wonder if there's a way to 
> tell 
> emacs to use a specific 'mode' from the command line, overriding the default 
> definition. Something like:

>  $emacs -f90 my_f90_file.f &

> to force emacs to already open the file with the f90 mode.

Another option than the -*- cookie is to try and autodetect which it is.
I.e. write

     (defun fortran-77-or-90-mode ()
       (if (... check the buffer, looking for special language constructs
            and/or keywords that only exist in one of the two dialects...)
           (fortran-mode)
         (f90-mode)))


-- Stefan


reply via email to

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