all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Finney <ben+gnu@benfinney.id.au>
To: 17333@debbugs.gnu.org
Subject: bug#17333: sh-mode: File local variables for setting shell variant
Date: Thu, 24 Apr 2014 10:40:04 +1000	[thread overview]
Message-ID: <20140424004003.GC20389@benfinney.id.au> (raw)

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@benfinney.id.au>





             reply	other threads:[~2014-04-24  0:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24  0:40 Ben Finney [this message]
2014-04-29 14:21 ` bug#17333: sh-mode: File local variables for setting shell variant Glenn Morris
2014-04-29 15:40   ` Stefan Monnier
2014-04-30  1:17     ` Ben Finney
2014-05-22 20:42     ` Glenn Morris
2014-04-30  1:01   ` Ben Finney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140424004003.GC20389@benfinney.id.au \
    --to=ben+gnu@benfinney.id.au \
    --cc=17333@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.