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

How to disable command echoing in Emacs shell?

1,860 views
Skip to first unread message

kj

unread,
Oct 18, 2010, 7:23:52 PM10/18/10
to

This question is surprisingly difficult to find an answer for:

How do I turn off the command echoing in *shell*? E.g., currently,
the interactions look like this:

% date
date
Mon Oct 18 19:22:46 EDT 2010

I want just this:

% date
Mon Oct 18 19:22:46 EDT 2010


TIA!

~kj

Barry Margolin

unread,
Oct 18, 2010, 9:40:06 PM10/18/10
to
In article <i9iku8$f1h$1...@reader1.panix.com>, kj <no.e...@please.post>
wrote:

stty -echo

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Sébastien Vauban

unread,
Oct 19, 2010, 3:39:44 AM10/19/10
to
Hello,

Barry Margolin wrote:


> In article wrote:
>
>> This question is surprisingly difficult to find an answer for:
>>

>> How do I turn off the command echoing in *shell*? I want just this:


>>
>> % date
>> Mon Oct 18 19:22:46 EDT 2010

In the same spirit, how to turn on the prompt in *shell*? I am on Windows XP
with Cygwin, and I just see:

--8<---------------cut here---------------start------------->8---
ls
file1.txt
file2.txt
file3.txt
pwd
/cygdrive/c/home/sva
--8<---------------cut here---------------end--------------->8---

where `ls' and `pwd' are in *bold*.

My settings are:

--8<---------------cut here---------------start------------->8---
;; for single shell commands
(setq shell-file-name "bash")

;; use `shell-file-name' as the default shell
(when (try-require 'env)
(setenv "SHELL" shell-file-name))

;; switch used to have the shell execute its command line argument
(setq shell-command-switch "-c")

;; quote process arguments to ensure correct parsing on Windows
(setq w32-quote-process-args t)

;; name of shell used to parse TeX commands
(setq TeX-shell shell-file-name)

;; shell argument indicating that next argument is the command
(setq TeX-shell-command-option shell-command-switch)

;; for the interactive (sub)shell
(setq explicit-shell-file-name shell-file-name)

;; args passed to inferior shell by `M-x shell', if the shell is bash
(setq explicit-bash-args '("--noediting" "--login"))
;; FIXME This ensures that /etc/profile gets read (at least for Cygwin).
;; Is this good?

;; general command interpreter in a window stuff
(when (try-require 'comint)

;; regexp to recognize prompts in the inferior process
(defun set-shell-prompt-regexp ()
(setq comint-prompt-regexp "^[^#$%>\n]*[#$%>] *"))
(add-hook 'shell-mode-hook 'set-shell-prompt-regexp)

;; don't add input matching the last on the input ring
(setq-default comint-input-ignoredups t)

;; input to interpreter causes (only) the selected window to scroll
(setq-default comint-scroll-to-bottom-on-input "this")

;; output to interpreter causes (only) the selected window to scroll
(setq-default comint-scroll-to-bottom-on-output "this")

;; show the maximum output when the window is scrolled
(setq-default comint-scroll-show-maximum-output t)

;; ignore short commands as well as duplicates
(setq comint-min-history-size 5)
(make-variable-buffer-local 'comint-min-history-size)
(setq-default comint-input-filter
(function
(lambda (str)
(and (not (string-match "\\`\\s *\\'" str))
(> (length str) comint-min-history-size)))))

;; functions to call after output is inserted into the buffer
(setq-default comint-output-filter-functions
;; go to the end of buffer (this can be irritating for
;; some)
'(comint-postoutput-scroll-to-bottom))

;; get rid of the ^M characters
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)

;; prompt in the minibuffer for password and send without echoing
;; (for example, with `su' command)
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)

;; use the `up' and `down' arrow keys to traverse through the previous
;; commands
(defun my/shell-mode-hook ()
"Customize my shell-mode."
(local-set-key (kbd "<up>") 'comint-previous-input)
(local-set-key (kbd "<down>") 'comint-next-input))
(add-hook 'shell-mode-hook 'my/shell-mode-hook))

;; regexp to match prompts in the inferior shell
(setq shell-prompt-pattern (concat "^" (system-name) " [^ ]+ \\[[0-9]+\\] "))
--8<---------------cut here---------------end--------------->8---

Best regards,
Seb

--
Sébastien Vauban

kj

unread,
Oct 19, 2010, 8:15:45 AM10/19/10
to

>In article <i9iku8$f1h$1...@reader1.panix.com>, kj <no.e...@please.post>
>wrote:

>> This question is surprisingly difficult to find an answer for:
>>
>> How do I turn off the command echoing in *shell*? E.g., currently,
>> the interactions look like this:
>>
>> % date
>> date
>> Mon Oct 18 19:22:46 EDT 2010
>>
>> I want just this:
>>
>> % date
>> Mon Oct 18 19:22:46 EDT 2010
>>
>>
>> TIA!
>>
>> ~kj

>stty -echo

Hmm. That was totally unexpected. I thought it would have been
some Emacs setting. (No wonder I couldn't find the answer.) Many
thanks!

~kj

hemal...@gmail.com

unread,
Nov 6, 2013, 5:17:23 PM11/6/13
to
On Tuesday, October 19, 2010 5:15:45 AM UTC-7, kj wrote:
> In <barmar-EC59B0....@news.eternal-september.org> Barry Margolin <barmar@***> writes:
>
> >In article <i9iku8$f1h$1...@reader1.panix.com>, kj <no.e...@please.post>
> >wrote:
>
> >> This question is surprisingly difficult to find an answer for:
> >>
> >> How do I turn off the command echoing in *shell*? E.g., currently,
> >> the interactions look like this:
> >>
> >> % date
> >> date
> >> Mon Oct 18 19:22:46 EDT 2010
> >>
> >> I want just this:
> >>
> >> % date
> >> Mon Oct 18 19:22:46 EDT 2010
> >>
> >>
> >> TIA!
> >>
> >> ~kj
>
> >stty -echo
>
> Hmm. That was totally unexpected. I thought it would have been
> some Emacs setting. (No wonder I couldn't find the answer.) Many
> thanks!
>
> ~kj

Another option is to set `comint-process-echoes` to `t`, which is indeed an Emacs setting :)
0 new messages