From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Error: Setting the shell in sh-mode via a local variable does not work
Date: Tue, 29 Dec 2015 02:32:38 +0100 [thread overview]
Message-ID: <87io3iyr7t.fsf@debian.uxu> (raw)
In-Reply-To: 568164D8.6050700@ojkastl.de
Johannes Kastl <mail@ojkastl.de> writes:
> 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 know two ways of doing that.
The first way is the best. I include my code as well.
It solves your problem at line 2:
(let ((modes '(
("\\.spec.in\\'" . (lambda () (interactive) (progn (sh-mode) (sh-set-shell "rpm"))))
("\\.bal\\'" . balance-mode)
("\\.gpi\\'" . gnuplot-mode)
("\\.\\(glsl\\|oil\\|ssc\\|dfy\\)\\'" . c-mode)
("\\.lu\\'" . lua-mode)
("\\.\\(service\\|list\\|theme\\|mailrc\\|sed\\|inc\\)\\'" . conf-mode)
("\\.pic\\'" . nroff-mode)
("\\.xr\\'" . conf-xdefaults-mode)
("inputrc\\'" . conf-colon-mode)
("KILL\\'" . emacs-lisp-mode)
("README\\'" . text-mode)
("\\.service\\'" . emacs)
)))
(setq auto-mode-alist (append modes auto-mode-alist)) )
Then the second way. Here you have to add
# spec.in
to every file. That isn't a lot of work, but I think
it is unaestethic. Files shouldn't be ABOUT
technology, they should be about what you can do, and
are doing WITH technology. Anyway:
(setq magic-mode-alist '(("# spec.in" . (lambda () (interactive) (progn (sh-mode) (sh-set-shell "rpm"))))))
;; another example:
;; (setq magic-mode-alist '(("/\\* cpp \\*/" . c++-mode)))
--
underground experts united
http://user.it.uu.se/~embe8573
next prev parent reply other threads:[~2015-12-29 1:32 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87io3iyr7t.fsf@debian.uxu \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).