From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: How to open a file in sh-mode Date: Thu, 14 Aug 2008 03:29:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: <64d8ebaf-0c89-4e9d-9aee-86b4e9414449@o40g2000prn.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1218710467 1011 80.91.229.12 (14 Aug 2008 10:41:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2008 10:41:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 14 12:41:57 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KTaHE-0003g5-7b for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2008 12:41:56 +0200 Original-Received: from localhost ([127.0.0.1]:50615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTaGH-000213-RF for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2008 06:40:57 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!o40g2000prn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 72 Original-NNTP-Posting-Host: 24.6.97.120 Original-X-Trace: posting.google.com 1218709756 20967 127.0.0.1 (14 Aug 2008 10:29:16 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 14 Aug 2008 10:29:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o40g2000prn.googlegroups.com; posting-host=24.6.97.120; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:161255 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:56601 Archived-At: On Aug 14, 12:53 am, "Francis Moreau" wrote: > Hello, > > I'm trying to open a file with emacs automatically set on sh-mode. > The file name can't be used to guess that emacs should be in sh-mode > when opening it. If the file content's first line starts with =E2=80=9C#!=E2=80=9D, then you= could use the magic-mode-alist. ----------------------------------- How Emacs Choose Modes Emacs determines what mode to use primarily by 2 mechanisms, in order: (1) Check the first line in the file, using =E2=80=9Cmagic-mode-alist=E2=80= =9D. (2) Check the file name's suffix, using =E2=80=9Cauto-mode-alist=E2=80=9D. The =E2=80=9Cmagic-mode-alist=E2=80=9D is a list that emacs use to match th= e first line of a file with a mode. For example, if you want files that begin with the line =E2=80=9C