all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Error: Setting the shell in sh-mode via a local variable does not work
@ 2015-12-28 16:35 Johannes Kastl
  2015-12-29  1:32 ` Emanuel Berg
  0 siblings, 1 reply; 38+ messages in thread
From: Johannes Kastl @ 2015-12-28 16:35 UTC (permalink / raw)
  To: help-gnu-emacs

-----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-----



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2016-01-01 18:31 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 16:35 Error: Setting the shell in sh-mode via a local variable does not work Johannes Kastl
2015-12-29  1:32 ` Emanuel Berg
2015-12-29 18:33   ` Johannes Kastl
2015-12-30 14:53     ` Emanuel Berg
2015-12-30 15:15       ` Robert Thorpe
2015-12-30 15:30         ` Emanuel Berg
2015-12-30 17:42         ` Johannes Kastl
2015-12-30 15:19   ` Teemu Likonen
2015-12-30 15:41     ` `append' vs. `nconc' (was: Re: Error: Setting the shell in sh-mode via a local variable does not work) Emanuel Berg
2015-12-30 16:37       ` `append' vs. `nconc' Teemu Likonen
2015-12-31  3:37         ` Emanuel Berg
     [not found]         ` <mailman.1400.1451533083.843.help-gnu-emacs@gnu.org>
2015-12-31  3:45           ` Pascal J. Bourguignon
2015-12-31  4:00             ` Emanuel Berg
2015-12-31  9:22               ` tomas
2015-12-31 18:48                 ` Emanuel Berg
     [not found]             ` <mailman.1402.1451534421.843.help-gnu-emacs@gnu.org>
2015-12-31  5:36               ` Pascal J. Bourguignon
2015-12-31  3:50         ` Emanuel Berg
     [not found]         ` <mailman.1401.1451533833.843.help-gnu-emacs@gnu.org>
2015-12-31  5:37           ` Pascal J. Bourguignon
2015-12-31  7:13             ` Emanuel Berg
2015-12-31  9:30               ` tomas
2015-12-31 17:56                 ` side effects, list sharing [was: `append' vs. `nconc'] Drew Adams
2015-12-31 19:00                   ` Emanuel Berg
2015-12-31 19:15                     ` Drew Adams
2016-01-01 13:20                       ` Emanuel Berg
2015-12-31 18:51                 ` `append' vs. `nconc' Emanuel Berg
     [not found]                 ` <mailman.1440.1451588113.843.help-gnu-emacs@gnu.org>
2016-01-01  2:53                   ` Barry Margolin
2016-01-01 13:26                     ` Emanuel Berg
     [not found]             ` <mailman.1406.1451546036.843.help-gnu-emacs@gnu.org>
2015-12-31  8:54               ` Pascal J. Bourguignon
2015-12-31  7:31           ` Teemu Likonen
2015-12-31 18:35             ` Emanuel Berg
2015-12-31 20:04               ` Teemu Likonen
2016-01-01 13:23                 ` Emanuel Berg
2016-01-01 14:02                   ` Teemu Likonen
2016-01-01 18:31                     ` Emanuel Berg
     [not found]             ` <mailman.1438.1451586967.843.help-gnu-emacs@gnu.org>
2016-01-01  6:25               ` Pascal J. Bourguignon
2016-01-01 13:31                 ` Emanuel Berg
2016-01-01 15:04                   ` Drew Adams
     [not found]     ` <mailman.1353.1451490125.843.help-gnu-emacs@gnu.org>
2015-12-30 16:18       ` Pascal J. Bourguignon

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.