bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: executable.el / sh-script.el problem?


From: Adam Spiers
Subject: Re: executable.el / sh-script.el problem?
Date: Wed, 23 Jan 2002 17:51:23 +0000
User-agent: Mutt/1.2.5i

Richard Stallman (address@hidden) wrote:
>     Visiting a fresh buffer and performing M-x sh-mode does not
>     automatically insert the magic #! line at the top of the script-to-be,
>     nor does it automatically make the file executable on saving, as I was
>     led to expect by the documentation in executable.el.
> 
> This is not a bug.  Merely selecting a major mode in Emacs is not
> supposed to do such things to your file's contents and modes.

I see.

> You can call sh-set-shell if you want to do such things.
> 
> Where in executable.el is there documentation that appears
> to say that sh-mode would do these things?  I don't see it,
> but if you point it out to me, I will fix it.

Sorry, I should have been more precise.  Two paths of reasoning lead
me to expect it.  One was erroneous, and gave rise to my mention of
the documentation in executable.el.  The other was a comment I spotted
towards the end of the definition of sh-mode in sh-script.el:

 (define-derived-mode sh-mode nil "Shell-script"
 [...]
    ;; Parse or insert magic number for exec, and set all variables depending
    ;; on the shell thus determined.

It was the "or insert" that convinced me.  A just punishment for
preferring to read source rather than type C-h m, no doubt!

So I guess this is a feature request rather than a bug report, namely
that it be possible to locally customise my emacs in some way so that
insert-flag is non-nil even when I'm visiting a shell-script for the
first time.  It seems to me that it would be trivial to add a new
defcustom variable which is used when sh-mode invokes sh-set-shell,
but there may be good reasons for not doing this.  (Patch available on
request if there are no problems with this approach.)

Thanks,

Adam



reply via email to

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