From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: Error: Setting the shell in sh-mode via a local variable does not work Date: Wed, 30 Dec 2015 17:19:42 +0200 Message-ID: <87si2kezg1.fsf@mithlond.arda> References: <568164D8.6050700@ojkastl.de> <87io3iyr7t.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1451488831 16090 80.91.229.3 (30 Dec 2015 15:20:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2015 15:20:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 16:20: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 1aEIXv-0004QL-Pc for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 16:20:15 +0100 Original-Received: from localhost ([::1]:52796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIXv-0003tp-8C for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 10:20:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIXg-0003tO-GP for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 10:20:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEIXb-0002Ll-FD for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 10:20:00 -0500 Original-Received: from mta-out1.inet.fi ([62.71.2.231]:35368 helo=johanna1.inet.fi) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIXb-0002JA-4G for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 10:19:55 -0500 RazorGate-KAS: Status: not_detected RazorGate-KAS: Rate: 0 RazorGate-KAS: Envelope from: RazorGate-KAS: Version: 5.5.3 RazorGate-KAS: LuaCore: 80 2014-11-10_18-01-23 260f8afb9361da3c7edfd3a8e3a4ca908191ad29 RazorGate-KAS: Lua profiles 69136 [Nov 12 2014] RazorGate-KAS: Method: none Original-Received: from mithlond.arda (84.251.143.106) by johanna1.inet.fi (9.0.002.03-2-gbe5d057) id 567CC1480073B1D8 for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 17:19:47 +0200 Original-Received: from dtw by mithlond.arda with local (Exim 4.84) (envelope-from ) id 1aEIXS-0003uD-2a for help-gnu-emacs@gnu.org; Wed, 30 Dec 2015 17:19:46 +0200 In-Reply-To: <87io3iyr7t.fsf@debian.uxu> (Emanuel Berg's message of "Tue, 29 Dec 2015 02:32:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 62.71.2.231 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:108523 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I'll add some simple Lisp programming notes that are unrelated to your discussion. I hope you don't mind. :-) Emanuel Berg [2015-12-29 02:32:38+01] wrote: > (let ((modes '( > ))) > (setq auto-mode-alist (append modes auto-mode-alist)) ) There you create a list MODES and then APPEND copies the whole list and joins it to AUTO-MODE-ALIST. The original list is discarded. No problem, it's just a configuration code. But in some other situation it might be good idea to construct the list only once and use NCONC which only traverses the lists through and modifies last conses to join it to the next list: (let ((modes (list '(a . b) ;; ... ))) (setq auto-mode-alist (nconc modes auto-mode-alist))) Or: (setq auto-mode-alist (nconc (list '(a . b) ;; ... ) auto-mode-alist)) I used LIST function because, at least in Common Lisp, literal objects (like lists created with QUOTE ' or literal strings) shouldn't be modified. Consequences are undefined. > (setq magic-mode-alist '(("# spec.in" . (lambda () (interactive) (pro= gn (sh-mode) (sh-set-shell "rpm")))))) The PROGN is redundant because LAMBDA has an implicit PROGN: (lambda () (interactive) (sh-mode) (sh-set-shell "rpm")) =2D-=20 /// Teemu Likonen - .-.. // // PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 /// --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWg/YRAAoJEHGdadMkU5RQM6AP/2SbpHrbNEFrAZpYNailzkpm GPFJRYe2zaVIzCdYTqXvsa2na91ceyxG7kuhwumyxSsu0j32gh6cslgCAMTeefSe oTPuuRswkW1Cut0FGpO4r7uuXK8lLGwFB7ty0eaU/yCK3mkxIZpA6F1E324Rc+Q2 UKryR+nVmUo+HbSzwTwqh9ks2euXvQVxlRAg+CwGwHE6CAzCVRWbZltnJ/lRCaCc xwbIvoX12Qh8Wcz2T4I7p4gUCpmP+zsapFUU7Iyar2/TZ2eGYmT9neqw886LrbpB crz7faDigBwt7YxnU4lUSJMhUamLEoOS3xiWN6nhpYS3FaI0PNH/iuXDMm7x9gMp rjARhN8sbfkygC5wOwaCP5pRhiezLf0x3Ah3V9uAnCTQrcI5VZylL/puBiz0RMCj h5qu7RBzuHNnTLg83pBsVMEMWtPyfIcXMamuu4dFYLyvReqa8K+xENfcP2a8urno 0UR8g4Mh3qsHJrm4i5MRoep9D+XYET0erX36gSYw+VmGn0pqOgbT+5C6XhsLl4Gu lv6rz0wlyRpkpYBIuWpoMX3JNypVfr8ivgunzd6r/ks/u8or895BvXtXqHDpRJmn e2fAwxqJaGsDSSFnGmzT/2YRPdQLBc4upok167dHNzN12Ap2s9G04oPuW+SiwF7j qkSgR8VxhcMEA5u5NhcE =nK5r -----END PGP SIGNATURE----- --=-=-=--