From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: select 'mode' from command line? Date: Fri, 01 Jul 2005 23:23:03 -0400 Organization: Bell Sympatico Message-ID: <87r7eh99md.fsf-monnier+gnu.emacs.help@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120275092 24996 80.91.229.2 (2 Jul 2005 03:31:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 2 Jul 2005 03:31:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 02 05:31:31 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DoYj4-0001Xz-JJ for geh-help-gnu-emacs@m.gmane.org; Sat, 02 Jul 2005 05:31:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DoYre-000752-7j for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Jul 2005 23:40:22 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!news.glorb.com!wns14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:WOeAoezLYpjuE3RN8zJksHmvAlY= Original-Lines: 21 Original-NNTP-Posting-Host: 67.68.216.130 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1120274583 67.68.216.130 (Fri, 01 Jul 2005 23:23:03 EDT) Original-NNTP-Posting-Date: Fri, 01 Jul 2005 23:23:03 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:132296 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:27771 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27771 > 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