From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johannes Kastl Newsgroups: gmane.emacs.help Subject: Error: Setting the shell in sh-mode via a local variable does not work Date: Mon, 28 Dec 2015 17:35:36 +0100 Message-ID: <568164D8.6050700@ojkastl.de> 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 1451323315 25464 80.91.229.3 (28 Dec 2015 17:21:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Dec 2015 17:21:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 28 18:21:44 2015 Return-path: Envelope-to: geh-help-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 1aDbUO-00029w-It for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 18:21:44 +0100 Original-Received: from localhost ([::1]:45478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbUN-0001nC-Vf for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 12:21:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDalw-0006u2-Py for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 11:35:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDalr-0001Vn-1Y for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 11:35:48 -0500 Original-Received: from www67.your-server.de ([213.133.104.67]:59614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDalq-0001UE-Sk for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 11:35:42 -0500 Original-Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www67.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.80.1) (envelope-from ) id 1aDals-0005qi-2K; Mon, 28 Dec 2015 17:35:44 +0100 Original-Received: from [188.194.74.155] (helo=Shirkhan.ojkastl.zz) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.84) (envelope-from ) id 1aDall-0007um-N1; Mon, 28 Dec 2015 17:35:37 +0100 Openpgp: id=CBB4118A9672ADE3A8DB45F6CE2DE043FC444DB2; url=http://ojkastl.de/pub/Johannes_Kastl_0xFC444DB2.asc X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 X-Authenticated-Sender: webmaster@ojkastl.de X-Virus-Scanned: Clear (ClamAV 0.98.7/21202/Mon Dec 28 14:35:56 2015) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.133.104.67 X-Mailman-Approved-At: Mon, 28 Dec 2015 12:20:41 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108508 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear all, first of all, sorry if I failed in finding the answer to my question on the web. I have a file called 'whatever.spec.in', that basically is a rpm spec file. (Technically, the spec file is generated from this file). So, I'd like to have the nice rpm sh-mode, that my emacs uses for files called 'whatever.spec'. I googled a lot about major-modes, interpreter-mode-alist and all kinds of stuff, even derived my own major-mode, but all fail, except this: (add-hook 'sh-mode-hook (lambda () (if (string-match "\\.spec\\.in$" buffer-file-name) (sh-set-shell "rpm")))) This works. But: The file contains some local variables at the end, that should achieve the same: # Local variables: # mode: shell-script # sh-shell: rpm # end: But regardless of what I put in the 'mode' and 'sh-shell' lines, I always end up with shell-script[bash] when opening the file as whatever.spec.in. If I rename it to whatever.spec, I get shell-script[rpm]. Is this intended behaviour? Shouldn't the 'sh-shell:' line work? I get no warning about malformed lines, so I think it is syntactically correct. Putting these local variables into an empty file call whatever.txt gets me shell-script[bash], so apparently the 'mode:' line is used. Thanks in advance, and please excuse the long descriptions... Johannes P.S.: System is OSX 10.10, emacs is GNU Emacs 24.5.1 from macports -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/ iEYEARECAAYFAlaBZNIACgkQzi3gQ/xETbJLQgCfeBj+bVh4IzYCIb+CEMokqnko MJYAn1dUEBM7w3VWCQa+/01gtKLcGulB =r6ms -----END PGP SIGNATURE-----