comint-watch-for-password-prompt
(see the Shell Mode manual).The following environment variables make sense when using Emacs:
export EDITOR="/usr/bin/emacsclient -a /usr/bin/emacs" export ALTERNATE_EDITOR="/usr/bin/emacs"
Put it into files ~/.bashrc
and ~/.xsession
(and/or friends, see Environmental Settings Wiki page).
To have shell coloring in Shell Mode the following code might be helpful in ~/.bashrc
.
if [ "${INSIDE_EMACS/*comint*/comint}" == "comint" -o \ "${INSIDE_EMACS/*tramp*/tramp}" == "tramp" ] ; then export GIT_PAGER="" export TERM=ansi fi
If you want to use sudo with Emacs Lisp function shell-command then it possibly does not work in a graphical environment like GTK+. 1) For this case i created a shell-script askpass.sh
, with the following content:
#!/bin/sh gksudo --print-pass --preserve-env --description "sudo password" 2>/dev/null
Then set environment variable
export SUDO_ASKPASS="$HOME/bin/askpass.sh"
and implement your shell command:
(shell-command (format "sudo -E -A my-sudo-cmd %s" my-sudo-execdir))
comint-watch-for-password-prompt
(see the Shell Mode manual).