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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17333 in the body.
You can then email your comments to 17333 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Thu, 24 Apr 2014 00:59:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ben Finney <ben+gnu <at> benfinney.id.au>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 24 Apr 2014 00:59:03 GMT)
Full text and
rfc822 format available.
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>
Added tag(s) confirmed.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 28 Apr 2014 00:36:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Tue, 29 Apr 2014 14:22:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 17333 <at> debbugs.gnu.org (full text, mbox):
Ben Finney wrote:
> 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.
I'd also like a way to do this.
In the past I've used
-*- mode: sh; eval: (sh-set-shell "tcsh" nil nil) -*-
but it is not great.
Ideas that come to mind are a bunch of aliases (sh-bash-mode etc) that
DTRT (yuck?); or sh-mode could add something to
hack-local-variables-hook that respects a file-local `sh-buffer-shell'
or somesuch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Tue, 29 Apr 2014 15:41:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 17333 <at> debbugs.gnu.org (full text, mbox):
>> 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.
> I'd also like a way to do this.
> In the past I've used
> -*- mode: sh; eval: (sh-set-shell "tcsh" nil nil) -*-
> but it is not great.
> Ideas that come to mind are a bunch of aliases (sh-bash-mode etc) that
> DTRT (yuck?);
Actually I think having sh-csh-mode, sh-sh-mode, and sh-rc-mode would be
a good idea.
> or sh-mode could add something to hack-local-variables-hook that
> respects a file-local `sh-buffer-shell' or somesuch.
The var's name is `sh-shell', and I guess this could make sense for the
"fine tuning" (e.g. distinguish between csh and tcsh), tho I'm not sure
it's worth the trouble.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Wed, 30 Apr 2014 01:03:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 17333 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 29-Apr-2014, Glenn Morris wrote:
> Ben Finney wrote:
>
> > 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.
>
> I'd also like a way to do this.
> In the past I've used
>
> -*- mode: sh; eval: (sh-set-shell "tcsh" nil nil) -*-
>
> but it is not great.
Partly because, AIUI, having ‘eval’ in the file's local variables is a
security hole, and is often disabled.
> Ideas that come to mind are a bunch of aliases (sh-bash-mode etc) that
> DTRT (yuck?); or sh-mode could add something to
> hack-local-variables-hook that respects a file-local `sh-buffer-shell'
> or somesuch.
I'd expect to be able to set the shell variant similar to the way that
I can set the SQL dialect::
# Local variables:
# coding: utf-8
# mode: sql
# sql-product: postgres
# End:
So, for example::
# Local variables:
# coding: utf-8
# mode: sh
# shell-variant: bash
# End:
would be a good interface for this feature, IMO.
--
\ “I went to the cinema, it said ‘Adults: $5.00, Children $2.50’. |
`\ So I said ‘Give me two boys and a girl.’” —Steven Wright |
_o__) |
Ben Finney <ben <at> benfinney.id.au>
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Wed, 30 Apr 2014 01:19:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 17333 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 29-Apr-2014, Stefan Monnier wrote:
> The var's name is `sh-shell', and I guess this could make sense for the
> "fine tuning" (e.g. distinguish between csh and tcsh), tho I'm not sure
> it's worth the trouble.
Having access, via the file's local variables, to set that variable
(or something equivalent like “shell-variant”) is exactly what this
bug report is about. So yes, that would be ideal.
--
\ “It's all in the mind, you know.” —The Goon Show |
`\ |
_o__) |
Ben Finney <ben <at> benfinney.id.au>
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17333
; Package
emacs
.
(Thu, 22 May 2014 20:43:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 17333 <at> debbugs.gnu.org (full text, mbox):
You can apparently do this now in the Emacs trunk, by setting `sh-shell'
as a file-local variable. So this is something that should appear in
the-Emacs-after-24.4.
(There's no NEWS entry.)
bug marked as fixed in version 24.5, send any further explanations to
17333 <at> debbugs.gnu.org and Ben Finney <ben+gnu <at> benfinney.id.au>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 22 May 2014 20:43:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 20 Jun 2014 11:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug Marked as fixed in versions 25.1.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug No longer marked as fixed in versions 24.5.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 04 Oct 2014 16:36:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 02 Nov 2014 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.