can't "stty -echo nl" in tcsh in Emacs M-x shell

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Geoffrey S Knau » Fri, 18 Apr 1997 04:00:00



I'm in Emacs in a shell started with M-x shell.  The sysadmin where I
work gave me tcsh as my default shell.  In the Emacs *shell* buffer,
every command is echoed and every output line has ^M at the end.  I've
tried to turn this off with "stty -echo nl" but tcsh just doesn't seem
to be listening.  I've tried convincing tcsh with its setty builtin,
but that hasn't worked either.  "stty -echo nl" works fine with bash
and csh, though.  Has anyone else seen this?
--

 
 
 

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Len E. El » Sat, 19 Apr 1997 04:00:00



Quote:

> I'm in Emacs in a shell started with M-x shell.  The sysadmin where I
> work gave me tcsh as my default shell.  In the Emacs *shell* buffer,
> every command is echoed and every output line has ^M at the end.  I've
> tried to turn this off with "stty -echo nl" but tcsh just doesn't seem
> to be listening.  I've tried convincing tcsh with its setty builtin,
> but that hasn't worked either.  "stty -echo nl" works fine with bash
> and csh, though.  Has anyone else seen this?

I'm using GNU Emacs 19.34.1 (sparc-sun-sunos4.1.4, X toolkit) and I did have
the same problem using csh.

I put the following in my .cshrc to take care these two things. The 'stty nl'
is needed to keep ^M from being displayed in the shell buffer (GNUS Emacs FAQ
(10 Jul 96), Question #71) and the 'stty -echo' is to keep commands from being
displayed before execution.

--------8<-----------(Cut here - start of included data)-----------------------

if ($?EMACS) then
   if ("$EMACS" == t) then
      stty nl -echo
   endif
endif

--------8<------------(Cut here - end of included data)------------------------

Now, I'm not sure if this will work with tcsh, but it's worth a shot.

Later,
Len E. Elam
------------------------------------------------------------------------------
 Len E. Elam, Software Engineer       | 'You will never realize the extent
 Lockheed Martin Information Systems  |  of your mistakes until you realize
 PO Box 748, Mail Zone 1025           |  that you can't eat your money.'
 Fort Worth, Texas 76101-0748         |  
 (817)763-6079                        |  -- Zack to KnownThief, Santa Fe, NM
------------------------------------------------------------------------------

 
 
 

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Arthur Wo » Sat, 19 Apr 1997 04:00:00


Emacs has built in functions to handle these problems.  I've got the
following in my .emacs:
(setq shell-mode-hook
   '(lambda ()
        (add-hook 'comint-output-filter-functions
              'shell-strip-ctrl-m)
        (setq comint-process-echoes 1)
        ))

I've also got the following lines (below the lambda () line above, before
the closing parens) , in case anyone is interested in making
shell-mode nicer still:
        (setq comint-scroll-to-bottom-on-input t)
        (local-set-key [up] 'comint-previous-input)
        (local-set-key [down] 'comint-next-input)
        (setq comint-scroll-show-maximum-output t)
        (setq comint-input-autoexpand "input")

 
 
 

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Sherif Gha » Sat, 19 Apr 1997 04:00:00



Quote:

> I'm in Emacs in a shell started with M-x shell.  The sysadmin where I
> work gave me tcsh as my default shell.  In the Emacs *shell* buffer,
> every command is echoed and every output line has ^M at the end.  I've
> tried to turn this off with "stty -echo nl" but tcsh just doesn't seem
> to be listening.  I've tried convincing tcsh with its setty builtin,
> but that hasn't worked either.  "stty -echo nl" works fine with bash
> and csh, though.  Has anyone else seen this?

Adding the following to your .emacs should get rid of the ^M's under tcsh.
I am not sure how to stop the echo.

(add-hook 'comint-output-filter-functions
          'comint-strip-ctrl-m)

;comint-strip-ctrl-m          Type M-x comint-strip-ctrl-m RET
;  Command: Strip trailing `^M' characters from the current output group.

Cheers,
Sherif Ghali

 
 
 

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Jacques Duthe » Sun, 20 Apr 1997 04:00:00



> I'm in Emacs in a shell started with M-x shell.  The sysadmin where I
> work gave me tcsh as my default shell.  In the Emacs *shell* buffer,
> every command is echoed and every output line has ^M at the end.  I've
> tried to turn this off with "stty -echo nl" but tcsh just doesn't seem
> to be listening.  I've tried convincing tcsh with its setty builtin,
> but that hasn't worked either.  "stty -echo nl" works fine with bash
> and csh, though.  Has anyone else seen this?

I had the same problem (with emacs started from a rlogin).
I rad the FAQ (C-h F) searched for ^M (characters '^' and 'M')
and tried, according to the FAQ:
    unset edit
    M-x shell-strip-ctrl-m
    stty -echo nl
I worked sometimes.  After I did a `ps', I found that my buffer's
shell was a tcsh.  So I put in .emacs file:
    (setq explicit-shell-name "/bin/csh")
and now everything is perfect (even via rlogin).
So, no change in the .[t]cshrc and no hook in the .emacs anymore.
--
| # # | # # # | # # | # # # | # # | # # # | Jacques Duthen   [jack] |

|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
 
 
 

can't "stty -echo nl" in tcsh in Emacs M-x shell

Post by Jay Roger » Sun, 20 Apr 1997 04:00:00



Quote:> In the Emacs *shell* buffer,
> every command is echoed and every output line has ^M at the end.  I've
> tried to turn this off with "stty -echo nl" but tcsh just doesn't seem
> to be listening.  I've tried convincing tcsh with its setty builtin,
> but that hasn't worked either.  "stty -echo nl" works fine with bash
> and csh, though.  Has anyone else seen this?

You also need to do an unset edit.  Here's what I have in my .cshrc

  if ($?tcsh && $?EMACS) eval 'unset edit; stty nl -echo' # tcsh in emacs

--
Jay Rogers