From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ben Finney Newsgroups: gmane.emacs.bugs Subject: bug#17333: sh-mode: File local variables for setting shell variant Date: Thu, 24 Apr 2014 10:40:04 +1000 Message-ID: <20140424004003.GC20389@benfinney.id.au> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1398301170 2827 80.91.229.3 (24 Apr 2014 00:59:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Apr 2014 00:59:30 +0000 (UTC) To: 17333@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 24 02:59:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wd80Y-0008MI-GZ for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Apr 2014 02:59:22 +0200 Original-Received: from localhost ([::1]:35298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd80Y-0002XX-74 for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Apr 2014 20:59:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd80P-0002X4-Kx for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 20:59:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wd80G-0000P1-0Y for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 20:59:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wd80F-0000Ow-T4 for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 20:59:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wd80F-0008Ap-Hh for bug-gnu-emacs@gnu.org; Wed, 23 Apr 2014 20:59:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ben Finney Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Apr 2014 00:59:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17333 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: GNU BTS submission Original-Received: via spool by submit@debbugs.gnu.org id=B.139830113931391 (code B ref -1); Thu, 24 Apr 2014 00:59:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Apr 2014 00:58:59 +0000 Original-Received: from localhost ([127.0.0.1]:56652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd80A-0008A8-Da for submit@debbugs.gnu.org; Wed, 23 Apr 2014 20:58:58 -0400 Original-Received: from rs400.luxsci.com ([66.135.55.5]:42632) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd7jo-0007fs-8a for submit@debbugs.gnu.org; Wed, 23 Apr 2014 20:42:06 -0400 Original-Received: from rs400.luxsci.com (localhost.localdomain [127.0.0.1]) by rs400.luxsci.com (8.13.8/8.13.8) with ESMTP id s3O0g2Xx028608 for ; Wed, 23 Apr 2014 19:42:03 -0500 Original-Received: (from root@localhost) by rs400.luxsci.com (8.13.8/8.13.8/Submit) id s3O0f3nL028373 for submit@debbugs.gnu.org; Thu, 24 Apr 2014 00:41:03 GMT Original-Received: (from sender 99054) (rs400.luxsci.com [127.0.0.1]) by Lux Scientiae SP; Thu, 24 Apr 2014 00:41:02 +0000 Original-Received: from localhost (eth595.vic.adsl.internode.on.net [150.101.214.82]) (user=ben@benfinney.id.au mech=PLAIN bits=0) by rs400.luxsci.com (8.13.8/8.13.8) with ESMTP id s3O0e9vq027307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Wed, 23 Apr 2014 19:40:12 -0500 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Lux-Comment: Message s3O0e9vq027307 sent by user #99054 X-Comment: Lux Scientiae SP Message ID - 1398300062-8635671.4220061 X-Mailman-Approved-At: Wed, 23 Apr 2014 20:58:55 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88267 Archived-At: 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