[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 18:26:15 -0600 (CST)

>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

# <your comment> -*- 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.



reply via email to

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