Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

No csh mode for emacs?

121 views
Skip to first unread message
Message has been deleted

David Masterson

unread,
Sep 27, 1996, 3:00:00 AM9/27/96
to

>>>>> "Dan" == Dan Harkless <d...@cafws4.eng.uci.edu> writes:

> It continues to surprise me that there is a sh / ksh mode for emacs, but not
> a csh / tcsh mode. Anyone know of one?

In GNU Emacs, there is shell-script.el which (I think) is the standard mode
for editing all shell scripts (it should figure it out by the "#!..." line at
the beginning of your script).

In XEmacs <=19.14, there is no csh-mode.el delivered with it. You could find
a couple of csh modes on the Ohio State Elisp Archives (last time I looked)
that basically work with XEmacs (not font-locking).

I understand that shell-script.el will be incorporated into XEmacs 19.15. You
could also pick up shell-script.el from GNU Emacs and just use it now (I think
it only needs a really minor change to work with XEmacs).

--
==================================================================
David Masterson KLA Instruments
408-456-6836 P.O. Box 49055 M/S F1-9440
dav...@prism.kla.com San Jose, CA 95161-9055
==================================================================
I only speak for myself -- it keeps me out of trouble

Richard Pieri

unread,
Sep 27, 1996, 3:00:00 AM9/27/96
to

-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "DH" == Dan Harkless <d...@cafws4.eng.uci.edu> writes:

DH> It continues to surprise me that there is a sh / ksh mode for emacs,
DH> but not a csh / tcsh mode. Anyone know of one?

Um, why in blazes would you want one? Did you not know that trying to
write C shell scripts is hazardous to your health? Tom Christiansen's
article on the topic is widely distributed; you should read it.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv

iQCVAwUBMkvmqJ6VRH7BJMxHAQGzyQP/Z2UHU9V96cYw0QavhJ1oHtvZb3eYqmbo
8K7YNx3qV+TR6UzYnyxMRpTTUrMqIVk+3a0MRTZgYapL2BsLxjM23ZEYqaEiR/kP
oghQT1bIknGmE9KMa8CZgmbLFY5SZeV1m8Bj11cRI3U/EyR224rgmU/HT2hUu+x2
ulhrTrz6MMA=
=iZJM
-----END PGP SIGNATURE-----
--
Richard Pieri/Information Services \ Variety is the spice of life: one day
<rat...@unilab.dfci.harvard.edu> \ ignore people, the next day annoy
http://www.dfci.harvard.edu/ \ them. -A cat's guide to life

Mark Eichin

unread,
Oct 1, 1996, 3:00:00 AM10/1/96
to

> Um, why in blazes would you want one? Did you not know that trying to

> write C shell scripts is hazardous to your health? [ref csh.whynot]

because you want to edit your .login .logout .cshrc .tcshrc files, perhaps?

I'll know that emacs shell-script-mode does get invoked automatically,
at least for .cshrc...

Stephane Boucher

unread,
Oct 2, 1996, 3:00:00 AM10/2/96
to

Mark Eichin <eic...@cygnus.com> writes:

>
>
> > Um, why in blazes would you want one? Did you not know that trying to
> > write C shell scripts is hazardous to your health? [ref csh.whynot]
>
> because you want to edit your .login .logout .cshrc .tcshrc files, perhaps?

You know, No one forces you to use tcsh :-)
--
,
Stephane Boucher, ing s...@nortel.ca
- NORTEL - Tel: (613)763-9778
Bell-Northern Research / Recherches Bell-Northern

Jari Aalto

unread,
Oct 4, 1996, 3:00:00 AM10/4/96
to rat...@unilab.dfci.harvard.edu

-----BEGIN PGP SIGNED MESSAGE-----

| 27.9.96, Richard Pieri <rat...@unilab.dfci.harvard.edu>


|
| >>>>> "DH" == Dan Harkless <d...@cafws4.eng.uci.edu> writes:
|
| DH> It continues to surprise me that there is a sh / ksh mode for emacs,
| DH> but not a csh / tcsh mode. Anyone know of one?
|

| Um, why in blazes would you want one? Did you not know that trying to

| write C shell scripts is hazardous to your health? Tom Christiansen's
| article on the topic is widely distributed; you should read it.

In case one does a simple things it doesn't matter which shell
language one uses. I've written solely in csh for years and never
encountered the problems Tom mentions about in his article.

Nowadays any more complicated task is programmed in Perl, that's
why the use of shell language doesn't matter much. IMHO.

But it's good to know the csh limitations, or advantages (that's why I
use it, it has nice :e :h etc. modifiers for variables.)

Cheers!
/jari
-----BEGIN PGP SIGNATURE-----
--
"The Man who makes no mistakes does not usually make anything."


Rob Walker

unread,
Oct 7, 1996, 3:00:00 AM10/7/96
to

Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:

> ME> because you want to edit your .login .logout .cshrc .tcshrc files,
> ME> perhaps?
>
> You should be using bash or at least ksh. The C shells are evil and
> have no soul.
>

is there some evidence as to this, I am trying to make a similar
decision myself. At least a few good flame wars that I can read about
the reasoning behind using the different shells.

tia,
Rob


Richard Pieri

unread,
Oct 7, 1996, 3:00:00 AM10/7/96
to

-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "JA" == Jari Aalto <ssj...@uta.fi> writes:

JA> In case one does a simple things it doesn't matter which shell
JA> language one uses.

$ for f in *; do
> <do something with $f>
> <do something else with $f>
> <do yet another thing with $f>
> done

I'd like to see you do that with a C shell on a command line.

[...]

JA> But it's good to know the csh limitations, or advantages (that's why
JA> I use it, it has nice :e :h etc. modifiers for variables.)

bash and ksh have nearly all the features of the C shells, including
tcsh, but without the limitations. And bash is free.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv

iQCVAwUBMlkN/56VRH7BJMxHAQEaqQP/Z4RSboS81r0OfWYgbNRGo/CAuvASmG5C
ySK6hjwQ9lSePySqL/U2CTiCberUD92rrYWwPTAVaYjsMK0IEd59lMhjRtYUBH7Y
9gbf1K3aBTNmPI21nUxRKcbo3LnZwGy2Nmx3JQikQYlhC1em6wMsJ8Ql1UH99Rq2
YXCoy9KLWCk=
=+UOD
-----END PGP SIGNATURE-----
--
Richard Pieri/Information Services \ Climb your way to the top; that's why the
<rat...@unilab.dfci.harvard.edu> \ drapes are there. -A cat's guide to life
http://www.dfci.harvard.edu/ \

Paul D. Smith

unread,
Oct 8, 1996, 3:00:00 AM10/8/96
to Rob Walker

%% Rob Walker <r...@cisco.com> writes:

rw> Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:

>> You should be using bash or at least ksh. The C shells are evil and
>> have no soul.

rw> is there some evidence as to this, I am trying to make a similar
rw> decision myself. At least a few good flame wars that I can read about
rw> the reasoning behind using the different shells.

Richard is 100% correct.

You can start by reading Tom Christiansen's "Csh Programming Considered
Harmful"--look on the comp.unix.shell newsgroup, or find it at the FAQ
archive rtfm.mit.edu.

Tom deals mainly with why you shouldn't write csh scripts, but once you
agree with him on that (and you surely will :), then ask yourself why
you want to script in one language and have a different one for
interactive use? It doesn't make sense.

--
-------------------------------------------------------------------------------
Paul D. Smith <psm...@baynetworks.com> Network Management Development
Senior Software Engineer Bay Networks, Inc.
-----------------------------------------------==<http://www.baynetworks.com/>-
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions--Bay Networks takes no responsibility for them.

Mark Hood

unread,
Oct 8, 1996, 3:00:00 AM10/8/96
to

psm...@baynetworks.com (Paul D. Smith) writes:
> %% Rob Walker <r...@cisco.com> writes:
> rw> Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:
>
> >> You should be using bash or at least ksh. The C shells are evil and
> >> have no soul.
>
> rw> is there some evidence as to this, I am trying to make a similar
> rw> decision myself.
>
> Richard is 100% correct.
>
> You can start by reading Tom Christiansen's "Csh Programming Considered
> Harmful"--look on the comp.unix.shell newsgroup, or find it at the FAQ
> archive rtfm.mit.edu.

I read this report and was impressed by all the bugs and problems in csh
that I never encountered in writing the many csh scripts I've had to develop
in my career :)

I think the csh man page puts it in perspective:

``Although robust enough for general use, adventures into the
esoteric periphery of the C shell may reveal unexpected
quirks.''

Actually, I've been using tcsh exclusively for scripts and interactive use
for the past couple of years. Is the use of tcsh just as evil, given
that it is compatible with csh, or are some of the bugs fixed or less
onerous in tcsh?

-- Mark Hood

Jari Aalto

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to psm...@baynetworks.com

-----BEGIN PGP SIGNED MESSAGE-----

| 8.10.96, psm...@baynetworks.com (Paul D. Smith) gnu.emacs.help


| %% Rob Walker <r...@cisco.com> writes:
|
| rw> Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:
|
| >> You should be using bash or at least ksh. The C shells are evil and
| >> have no soul.
|
| rw> is there some evidence as to this, I am trying to make a similar

| rw> decision myself. At least a few good flame wars that I can read about
| rw> the reasoning behind using the different shells.
|

| Richard is 100% correct.
|
| You can start by reading Tom Christiansen's "Csh Programming Considered
| Harmful"--look on the comp.unix.shell newsgroup, or find it at the FAQ
| archive rtfm.mit.edu.
|

| Tom deals mainly with why you shouldn't write csh scripts, but once you
| agree with him on that (and you surely will :), then ask yourself why
| you want to script in one language and have a different one for
| interactive use? It doesn't make sense.

Not to say anything about the sh vs. csh, but I have always used
csh and never needed Tom's advices that deal with more complex
programming. If I need complexity beyond csh I pick perl immediately.

There are some nice advantages using csh, especially some
handy :e :h :g modifiers and nice loops and easy case statements.
Of course it lacks functions that sh offers. Both have advantages
and disadvantages in my opinion.

I like csh, because it feels like home to me after C/C++.

If you really want good language, use perl, and don't even touch
shell languages :-)

Herve...@sema-grenoble.fr

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Jari Aalto writes:
> To: help-gn...@prep.ai.mit.edu
> Subject: Re: No csh mode for emacs?
>
> ...


> | 8.10.96, psm...@baynetworks.com (Paul D. Smith) gnu.emacs.help
> | %% Rob Walker <r...@cisco.com> writes:
> |
> | rw> Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:
> |

> | >> ...
> |
> | rw> ...
> |
> | Richard is 100% correct.
> |
> | ...


> | Tom deals mainly with why you shouldn't write csh scripts, but once you
> | agree with him on that (and you surely will :), then ask yourself why
> | you want to script in one language and have a different one for
> | interactive use? It doesn't make sense.

Well, I don't mind the sh/csh war, (and I've not read Tom's article), but,
concerning the last sentence, I do think it make sense: interactive use asks
for user-friendlyness while script writing asks for robustness (is this word
correct ?) and portability.

>
> ...


>
> There are some nice advantages using csh, especially some
> handy :e :h :g modifiers and nice loops and easy case statements.
> Of course it lacks functions that sh offers. Both have advantages
> and disadvantages in my opinion.

True. I'd add that the !! history style in (standard) csh is very helpful
(once mastered ;-)

If I had to choose between csh and ksh (for interactive use), I'd probably
choose ksh. But between ksh and tcsh, I'd choose tcsh.

BTW, I always write scripts in /bin/sh and I use bash interactively :-)

> I like csh, because it feels like home to me after C/C++.
>
> If you really want good language, use perl, and don't even touch
> shell languages :-)
>
> Cheers!
> /jari
>
>

To bring back the discussion to emacs, let's say that in an emacs shell
buffer, even /bin/sh is usable since emacs brings history and line edition ;-)

--

Herve Guyot

Sema Group - Division Energie et Industrie - Grenoble - FRANCE
E-mail : Herve...@sema-grenoble.fr

Barry A. Warsaw

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

>>>>> "JA" == Jari Aalto <ssj...@uta.fi> writes:

JA> If you really want good language, use perl, and don't even
JA> touch shell languages :-)

Or of course, if you want a great object-oriented scripting language
with a saner syntax, try Python!

<http://www.python.org/>

But then, I guess we're getting a little off topic for this newsgroup,
eh? ;-)

-Barry

Colin Rafferty

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to Richard Pieri, Jari Aalto

Richard Pieri writes:
>>>>>> "JA" == Jari Aalto <ssj...@uta.fi> writes:

JA> In case one does a simple things it doesn't matter which shell
JA> language one uses.

> $ for f in *; do
>> <do something with $f>
>> <do something else with $f>
>> <do yet another thing with $f>
>> done

> I'd like to see you do that with a C shell on a command line.

% foreach f (*.C)
? echo mv $f ${f:h}.cc
? mv $f ${f:h}.cc
? end

I use csh in my shell (in emacs, of course), and ksh in real shell
programming. What you learn is what you use. I still use awk/sed/grep,
and not perl.

--
Colin

Mark Hood

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

Richard Pieri <rat...@unilab.dfci.harvard.edu> writes:
> $ for f in *; do
> > <do something with $f>
> > <do something else with $f>
> > <do yet another thing with $f>
> > done
>
> I'd like to see you do that with a C shell on a command line.

% foreach f (*)
foreach? echo $f
foreach? grep foo $f
foreach? cat $f > /dev/null
foreach? end
% <lots of output>

Works fine; did I miss something?

-- Mark Hood

0 new messages