I want to send a command to a comint shell-mode
without it printing an additional prompt. I'm trying to use the comint-redirect-*
API, but I am still getting an additional prompt. What would be an easy way to either avoid the prompt printing altogether, or to track back and delete it?
My redirect,
(defun my-comint-redirect-silently (proc string)
(let (comint-redirect-perform-sanity-check)
(with-temp-buffer
;; possible to have shell not print prompt?
(comint-redirect-send-command-to-process
string (current-buffer) proc nil 'no-display)))
(with-current-buffer (process-buffer proc)
;; necessary to track back and delete here?
(comint-redirect-cleanup)))
Example of a call in a shell-hook,
(add-hook 'shell-mode-hook
(lambda ()
(my-comint-redirect-silently
(get-buffer-process (current-buffer)) "TERM=xterm-256color")))
But, the comint shell then prints the following (notice the double prompt)
me@me-M51AC: ~
$ me@me-M51AC: ~
$
Not directly relevant, but to show it is printing twice, the prompt here is set as
$ echo $PS1
${debian_chroot:+($debian_chroot)}\[\e[32m\]\u@\h: \[\e[33m\]\w\[\e[0m\]\n\$