Emacs: Stop popup window for gpg passphrase [close

2020-07-13 10:25发布

问题:

emacs is annoyingly popping up window and asking for pass phrase whenever I open a encrypted file (somefile.gpg, .authinfo.gpg). I would like it instead ask me for password in minibuffer.

is there any configuration option for that.?

Edit: Important to note, if I press escape on popup window, emacs will ask for password in minibuffer. So there is fallback exist in emacs, I like to make that fallback method as first choice.

UPDATE: Emacs version: GNU Emacs 24.3.50.12 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2) of 2013-05-28 on sealion

回答1:

Now I placed the following in .emacs which is finally disabling the gui prompt.

;; Do not use gpg agent when runing in terminal
(defadvice epg--start (around advice-epg-disable-agent activate)
  (let ((agent (getenv "GPG_AGENT_INFO")))
    (setenv "GPG_AGENT_INFO" nil)
    ad-do-it
    (setenv "GPG_AGENT_INFO" agent)))


回答2:

The comments on gpg-agent in C-h f epg-context-set-passphrase-callback RET look relevant, and I can see there is plenty of related discussion and apparent workarounds for this on the Emacs Wiki, under the heading "How to use a non-graphical password prompt for gpg":

http://emacswiki.org/emacs/EasyPG#toc4