From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help 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 Message-ID: <87io3iyr7t.fsf@debian.uxu> References: <568164D8.6050700@ojkastl.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451352805 24551 80.91.229.3 (29 Dec 2015 01:33:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Dec 2015 01:33:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 29 02:33:16 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 1aDjA3-0006Rk-Kd for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Dec 2015 02:33:15 +0100 Original-Received: from localhost ([::1]:46791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDjA2-0002Qz-Rk for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 20:33:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDj9o-0002OV-BP for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 20:33:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDj9l-0007EF-6e for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 20:33:00 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:51839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDj9k-0007DU-Vv for help-gnu-emacs@gnu.org; Mon, 28 Dec 2015 20:32:57 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aDj9e-00060C-Rs for help-gnu-emacs@gnu.org; Tue, 29 Dec 2015 02:32:50 +0100 Original-Received: from nl106-137-56.student.uu.se ([130.243.137.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Dec 2015 02:32:50 +0100 Original-Received: from embe8573 by nl106-137-56.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Dec 2015 02:32:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-56.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:NAioaIknrbQxpc65GlS0qkupfj0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108510 Archived-At: Johannes Kastl 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