views:

81

answers:

3

I'm using GNU Emacs on my Ubuntu netbook in fullscreen mode. When I edit files that are under version control and hit C-x v v to commit the latest changes, an OpenSSH popup window will open and ask me for my password for the server on which my repository lives.

Unfortunately, because of the fullscreen mode, the popup window will not come up front and I cannot enter my password. But it's still somehow modal, so I also can't go back to emacs and, say, leave fullscreen mode either (or do anything else, like C-g). I'm basically trapped.

As an emacs user, I find the idea of popup windows disgusting anyway ;-) so ideally, I'd like to be asked for the ssh password in the minibuffer. How can I tweak my setup to make that happen? (I prefer to type in my password every time instead of storing a keypair in ~/.ssh/).

+3  A: 

You could use ssh-agent before launching emacs (or in another shell).

Dirk Eddelbuettel
The original poster prefers entering passwords to using key based authentication. However I agree ssh-agent and key pairs is the better solution.
stsquad
A: 

I'm speculating here, as I neither use CVS or vc within Emacs, however I presume that Emacs is shelling out to the appropriate program to perform the commit, and the password prompt is something entirely external to Emacs. So I suspect what you want to do is firstly find out which options are needed to do a GUI-less commit from your shell without Emacs, and then modify vc-checkin-switches (or define vc-cvs-checkin-switches) in Emacs to match (see defun vc-switches).

phils
A: 

It's probably the ssh-askpass program kicking in, which I think looks at the DISPLAY environment variable to decide how to request the password. If set, it pops up a graphical window, and if not, it asks the TTY.

If the vcs subsystem detects when passwords are requested from the user (which is likely), then it's possible that you can unset $DISPLAY for subprocesses:

(setenv "DISPLAY" nil)

This might have other negative side-effects, though, so also check out "man ssh-askpass" in case something there might help.

(Disclaimer: I personally use a solution based on ssh-agent, which I strongly recommend.)

sanityinc
You could use advice or hooks to apply that to only the necessary code. I see that `vc-before-checkin-hook` and `vc-checkin-hook` (after) are defined, but I'm guessing you would need to do this for more than just commits?For (solely) the case of `C-x v v`, the following advice would cover it:`(defadvice vc-next-action (around my-ssh-prompt-fix-for-vc-next-action activate) (let ((backup (getenv "DISPLAY"))) (setenv "DISPLAY" nil) ad-do-it (setenv "DISPLAY" backup)))`
phils
If the environment that cvs runs in does affects this, then another option would be to over-ride the cvs command. `vc-cvs-command` hard-codes "cvs" as the command and passes it to `vc-do-command`, so one option would be to write a wrapper script for cvs (outside of Emacs) to execute the real command in a modified environment. That might affect non-Emacs calls to cvs though, so you could name the wrapper something other than "cvs" and create some before advice for `vc-do-command` to change the value of its `command` arg to match when it is "cvs".
phils
or maybe just use the advice approach from my first comment on `vc-do-command` instead of `vc-next-action` ?
phils