2

Various command-line tools, such as gdb, ftp, sftp, etc, use ! to prefix a command to be run in a shell. So (for instance) !mkdir foo will make a directory called foo. When using these tools inside emacs shell-mode, the shell-mode treats the ! as a history reference, does a history lookup, and expands the result before putting the command in the history ring. So if I have previously typed mkdir bar, shell-mode puts mkdir bar foo into the history ring.

Can I easily suppress all special treatment of ! in the shell history? I want the history to contain !mkdir foo. I don't ever use ! at the shell, so I'd be happy with a way of turning this off entirely, although I suppose it could be made switchable based on the prompt.

Nick Barnes
  • 141
  • 3

1 Answers1

2

Figured it out: (setq shell-input-autoexpand nil). I spent a long while looking at comint-input-autoexpand which was getting mysteriously set to 'history: this is done by shell-mode based on shell-input-autoexpand. I don't see an easy way to make it prompt-dependent, though.

Nick Barnes
  • 141
  • 3