all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setting shell type in sh-mode
@ 2002-10-17 15:12 Glenn Morris
  2002-10-17 17:00 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2002-10-17 15:12 UTC (permalink / raw)



sh-mode has a few different settings that it implements (font-lock
keywords, indentation, etc), according to the type of shell being edited
(bash, csh, etc).

The way it detects which type of shell is in use is to either look for an
interpreter at the start of the script (eg #!/bin/bash), or if that fails,
it falls back on the value of the variable sh-shell-file.

So how can I get my .tcshrc file recognised as a tcsh script?

If I add #!/usr/bin/tcsh to the top, firstly that's changing the file just to
keep Emacs happy; and secondly the file then gets made executable, since I
have executable-make-buffer-file-executable-if-script-p in after-save-hook
(which I rather like).

I can't use 

# -*- sh-shell-file "/usr/bin/tcsh" -*-

since local variables are hacked after the mode setup (including any hook)
has finished, and my default sh-shell-file is "/bin/bash". It seems that
adding after advice to sh-mode suffers from the same problem.

I could use

# -*- eval: (sh-set-shell "tcsh") -*-

but this means I have to set enable-local-eval to t if I'm not to be driven
mad by prompts, and I'd rather not have that setting, as a general rule.

Any ideas gratefully received (no doubt I've missed something obvious!).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-17 22:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-17 15:12 Setting shell type in sh-mode Glenn Morris
2002-10-17 17:00 ` Kevin Rodgers
2002-10-17 17:07   ` Glenn Morris
2002-10-17 21:41     ` Kevin Rodgers
2002-10-17 22:38       ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.