From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: sh-script.el and magic numbers Date: Tue, 21 Jan 2003 18:26:15 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301220026.SAA20752@eel.dms.auburn.edu> References: <200301190324.VAA14671@eel.dms.auburn.edu> <200301191247.h0JCl1Zs020036@beta.mvs.co.il> <8del78n1ks.fsf@ast.cam.ac.uk> <200301200759.h0K7xGOH007624@beta.mvs.co.il> <200301210045.SAA16966@eel.dms.auburn.edu> <200301211723.LAA19391@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1043195119 27610 80.91.224.249 (22 Jan 2003 00:25:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 22 Jan 2003 00:25:19 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18b8hh-0007B2-00 for ; Wed, 22 Jan 2003 01:25:17 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18b8jD-0002I8-00 for ; Wed, 22 Jan 2003 01:26:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18b8iy-0002kS-01 for emacs-devel@quimby.gnus.org; Tue, 21 Jan 2003 19:26:36 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18b8iS-0002EM-00 for emacs-devel@gnu.org; Tue, 21 Jan 2003 19:26:04 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18b8iF-0001sh-00 for emacs-devel@gnu.org; Tue, 21 Jan 2003 19:25:53 -0500 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18b8i3-0001Mb-00 for emacs-devel@gnu.org; Tue, 21 Jan 2003 19:25:39 -0500 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) by manatee.dms.auburn.edu (8.9.1a/8.9.1) with ESMTP id SAA05520; Tue, 21 Jan 2003 18:25:36 -0600 (CST) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.9.3+Sun/8.9.3) id SAA20752; Tue, 21 Jan 2003 18:26:15 -0600 (CST) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: teirllm@dms.auburn.edu In-reply-to: <200301211723.LAA19391@eel.dms.auburn.edu> (message from Luc Teirlinck on Tue, 21 Jan 2003 11:23:31 -0600 (CST)) Original-cc: gmorris+mail@ast.cam.ac.uk X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10957 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10957 >>From my earlier message: Is having enable-local-eval set to maybe (the default-value) that bad? (It is not going to execute any evals without asking you.) If it is, one could have sh-mode look for a definition of sh-shell-file in the local variable line, if there is no magic number. Then you could just set sh-shell-file and sh-mode would itself call sh-set-shell with the desired argument. I now believe that, if we absolutely want to handle the problem without using a local eval, it would be better to have sh-mode, if there is no magic number, add a buffer-local hook function to find-file-hook. That function would check the value of a buffer-local variable, say sh-local-shell-file (or whatever), and, if the variable is non-nil, call (sh-set-shell sh-local-shell-file). This would eliminate the need for the eval and # -*- mode: sh; sh-local-shell-file: /bin/csh; -*- would work. Defining sh-local-shell-file in a local variables list at the end of the file would work too. (The problem we want to circumvent is that file local variables get set after the mode function has already ran. So we use find-file-hook, which runs after the local variables have been set.) I am not going to worry further about implementation details before a decision is made on whether this would be desirable. Again, the only purpose of this would be to avoid having to use a local eval. If we do not mind about using a local eval, all that is required is adding a line or two to the mode's documentation string. Sincerely, Luc.