GNU bug report logs -
#17333
sh-mode: File local variables for setting shell variant
Previous Next
Reported by: Ben Finney <ben+gnu <at> benfinney.id.au>
Date: Thu, 24 Apr 2014 00:59:03 UTC
Severity: normal
Tags: confirmed
Found in version 24.3.1
Fixed in version 25.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Package: emacs
Version: 24.3.1
Severity: normal
Howdy,
The ‘sh-mode’ appears to have no means for allowing a non-executable
file to declare, in its local variables, the shell variant to use for
syntax.
Emacs allows me to specify that a shell include file should be opened
in sh mode, by setting a local variable in the editor hints::
# Local variables:
# coding: utf-8
# mode: sh
# End:
# vim: fileencoding=utf-8 filetype=bash :
I can specify to Vim that the file's shell variant is specifically
Bash, and it obeys the editor hint to present specific Bash syntax
highlighting. But Emacs has ‘sh’ mode which covers all shell variants.
The ‘sh’ mode will properly interpret such a file if it has a shebang
line (e.g. #! /bin/bash). But some files are not stand-alone programs,
so I do not want those to have a shebang line.
Emacs ‘sh’ mode treats those files as Posix shell syntax, which they
are not. ‘sh’ mode has the concept of “variant” of shell syntax; but
I'm unable to find out how to specify, in the file's editor hints,
which variant to use for the file.
How can I set the Emacs editor hints in the file such that, when the
file is opened, ‘sh’ mode knows that its syntax is Bash, or Zsh, etc.?
--
\ “If consumers even know there's a DRM, what it is, and how it |
`\ works, we've already failed.” —Peter Lee, Disney corporation, |
_o__) 2005 |
Ben Finney <ben <at> benfinney.id.au>
This bug report was last modified 10 years and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.