0

(xpost from Unix Stack Exchange)

I'm using a local shell via an Emacs shell buffer. Seemingly at random, my shell will start echoing back every command I type before the rest of the output.

h ~ $ pwd
pwd
/Users/ericauld
h ~ $ echo $-
echo $-
himBCH
h ~ $ bash --version
bash --version
GNU bash, version 5.2.21(1)-release (aarch64-apple-darwin23.0.0)
h ~ $ trap
trap

Notice that neither xtrace (-x) or verbose (-v) are set.

Often I can get it to stop by restarting the shell.

h ~ $ pwd
pwd
/Users/ericauld
h ~ $ exit
exit
exit

Process shell<1> finished
h ~ $ pwd
/Users/ericauld
h ~ $ 

I notice there are two echoed exits above, which could be a clue.

It seems to happen often, but not always, after I enter and exit a pdb session.

1
  • 1
    Do stty -a and check the echo part: in the case where the commands are echoed, that appears in the stty -a output as echo; in the case where they are not echoed, it appears as -echo. You can switch from one to the other with stty echo and stty -echo. Do man stty for (a lot of) details. I don't know why your shell starts with the echo setting on` sometimes.
    – NickD
    Feb 6 at 10:07

1 Answer 1

1

Try

(setopt comint-process-echoes t)

If non-nil, assume that the subprocess echoes any input.

(I'm not sure whether it helps because I can't reproduce what you described. sorry)

1
  • 1
    This should probably be used when the command interpreter that's used by comint always echoes, but for a shell, I would turn off the echo with stty -echo. Some programs do the equivalent of stty echo and turn echo on and when they quit, they forget to turn it off so the setting is maintained, but Emacs cannot do very much about that.
    – NickD
    Feb 6 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.