From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Henrik Austad Newsgroups: gmane.emacs.help Subject: Re: How to open a file in sh-mode Date: Thu, 14 Aug 2008 10:16:12 +0200 Organization: NTNU Message-ID: <200808141016.12117.henrikau@stud.ntnu.no> References: <38b2ab8a0808140053g6261aeafmd74692199cea07eb@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218758224 3077 80.91.229.12 (14 Aug 2008 23:57:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2008 23:57:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 15 01:57:56 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 1KTmhY-0002Lu-41 for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Aug 2008 01:57:56 +0200 Original-Received: from localhost ([127.0.0.1]:48868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTmgb-0000CL-Pl for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2008 19:56:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTY0H-0001Mm-14 for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 04:16:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTY0F-0001LY-M0 for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 04:16:16 -0400 Original-Received: from [199.232.76.173] (port=42596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTY0F-0001LU-JV for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 04:16:15 -0400 Original-Received: from tyholt.uninett.no ([158.38.62.9]:46029) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTY0F-0002jV-Bq for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 04:16:15 -0400 Original-Received: from pegasus.uninett.no (unknown [IPv6:2001:700:1:0:21e:37ff:fe82:c661]) by tyholt.uninett.no (Postfix) with ESMTP id 59E342BAD5F; Thu, 14 Aug 2008 10:16:12 +0200 (CEST) User-Agent: KMail/1.9.9 In-Reply-To: <38b2ab8a0808140053g6261aeafmd74692199cea07eb@mail.gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 14 Aug 2008 19:56:34 -0400 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:56641 Archived-At: On Thursday 14 August 2008 09:53:39 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. > > So I tried: > > $ emacs -f sh-mode foo > > But that doesn't work. > > Could anybody give me some advices ? 1) which version of emacs are you using? 2) is it a valid-sh file? i.e. does it start with #!/bin/bash on the first line? 3) have you enabled syntax-highlighting in the first place? if unsure, add (global-font-lock-mode t) to your ~/.emacs I've testet a file foo with the following content #!/bin/bash echo "Hello World" and emacs syntax-highlight this with versions 21, 22, 23.0.50 and 23.0.60 (although I expect that if it works in one version, it'll work in all). -- Med vennlig hilsen - Yours Sincerely Henrik Austad