unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* sh-mode
@ 2002-11-06 14:46 sylvain ferriol
  2002-11-06 15:02 ` sh-mode Alfred M. Szmidt
  0 siblings, 1 reply; 3+ messages in thread
From: sylvain ferriol @ 2002-11-06 14:46 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh-mode
  2002-11-06 14:46 sh-mode sylvain ferriol
@ 2002-11-06 15:02 ` Alfred M. Szmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Alfred M. Szmidt @ 2002-11-06 15:02 UTC (permalink / raw)
  Cc: help-gnu-emacs

   #mode: sh-mode

That should be "#mode: sh".  Next time please be more speficic about
your bug report, for example, describe what happened and what you
expected.  This will help reduce any guess work.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh-mode
       [not found] <mailman.1036594387.22226.help-gnu-emacs@gnu.org>
@ 2002-11-06 15:33 ` Michael Slass
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Slass @ 2002-11-06 15:33 UTC (permalink / raw)


sylvain ferriol <Sylvain.Ferriol@imag.fr> 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.
| 
| <snip>
|
|    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.
| 
| <snip>
| 
|    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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-06 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-06 14:46 sh-mode sylvain ferriol
2002-11-06 15:02 ` sh-mode Alfred M. Szmidt
     [not found] <mailman.1036594387.22226.help-gnu-emacs@gnu.org>
2002-11-06 15:33 ` sh-mode Michael Slass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).