From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Slass Newsgroups: gmane.emacs.help Subject: Re: sh-mode Date: Wed, 06 Nov 2002 15:33:15 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1036598641 22353 80.91.224.249 (6 Nov 2002 16:04:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 6 Nov 2002 16:04:01 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 189SeO-0005kz-00 for ; Wed, 06 Nov 2002 17:03:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 189SfQ-000246-00; Wed, 06 Nov 2002 11:04:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 59 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-NNTP-Posting-Host: 12.228.27.239 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: sccrnsc01 1036596795 12.228.27.239 (Wed, 06 Nov 2002 15:33:15 GMT) Original-NNTP-Posting-Date: Wed, 06 Nov 2002 15:33:15 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:106796 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3350 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3350 sylvain ferriol writes: >hello >i edit my_file.sh which is a bash file >and i want to put local variables for emacs in the file >how can i do that??? >for example >#!/bin/bash >#Local Variables: >#mode: sh-mode >#End: > >but this doesn't work > >thanks >sylvain > > > If all you want to do is set the mode, you can do that on the *second* line of the file. From the "Major Modes" node of the emacs manual: ,---- | You can specify which major mode should be used for editing a certain | file by a special sort of text in the first nonblank line of the file. | The mode name should appear in this line both preceded and followed by | `-*-'. Other text may appear on the line as well. For example, | | ;-*-Lisp-*- | | tells Emacs to use Lisp mode. Such an explicit specification overrides | any defaults based on the file name. Note how the semicolon is used to | make Lisp treat this line as a comment. | | | | When a file's contents begin with `#!', it can serve as an | executable shell command, which works by running an interpreter named on | the file's first line. The rest of the file is used as input to the | interpreter. | | | | When the first line starts with `#!', you cannot (on many systems) | use the `-*-' feature on the first line, because the system would get | confused when running the interpreter. So Emacs looks for `-*-' on the | second line in such files as well as on the first line. `---- so: #!/bin/bash # -*-sh-*- ... -- Mike Slass