[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error: Setting the shell in sh-mode via a local variable does not wo
From: |
Emanuel Berg |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
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