[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh-script.el and magic numbers

From: Luc Teirlinck
Subject: Re: sh-script.el and magic numbers
Date: Tue, 21 Jan 2003 11:23:31 -0600 (CST)

Glenn Morris wrote;

   No, I mean what was said in the thread I referred to, namely:

   # -*- mode: sh; sh-shell: csh; mode-line-process: "[csh]"-*-

   which works without the need for enabling eval of local variables. But it's
   a little ugly, and doesn't work right, since it still prints "indentation
   set up for shell type bash". I'd prefer just a single variable that
   controls what shell flavour a file is.

That solution really does not seem solid at all.  Not only is the
indentation wrong, but moreover sh-shell is now csh, whereas
sh-shell-file still has its usual value, in my case
"/usr/local/bin/bash".  This means half of sh-script.el thinks you are
programming for csh and the other half thinks you are programming for
bash.  This is bad.  I doubt that the problems caused by that are
limited to the indentation problems (which are bad enough anyway.)

I personally believe that the only solid way to switch shells is to
call sh-set-shell.  Otherwise, you have to emulate everything
sh-set-shell does, including (run-hooks 'sh-set-shell-hook).  This
seems hopeless.

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.

Can anybody think of a simple, but thoroughly solid, solution, not
involving code changes, that works when enable-local-eval is nil?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]