[PATCH] Add inside-Emacs mode to GUI pinentry programs

Daiki Ueno ueno at gnu.org
Mon Jun 15 05:15:51 CEST 2015

"Neal H. Walfield" <neal at walfield.org> writes:

> At Sun, 14 Jun 2015 19:11:35 +0200,
> Werner Koch wrote:
>> On Sun, 14 Jun 2015 15:35, neal at walfield.org said:
>> > Now that I think about this some more: isn't it required that we
>> > ignore the setting of INSIDE_EMACS for gpg-agent?  We want to use
>> If we consider INSIDE_EMACS to have a simlar effect like DISPLAY we
>> should do this.  But be prepared that soon someone will ask for a
>> --keep-inside-emacs option to make it really similar on how we handle
> In what situation does that make sense?  Don't we always want to use
> the DISPLAY of the gpg process and not the gpg-agent?  I think the
> same holds for INSIDE_EMACS.

For INSIDE_EMACS, it would make more sense to clear the variable on
gpg-agent startup.  Otherwise, the initial value will remain in effect
during the session:

  $ pkill gpg-agent
  $ INSIDE_EMACS=1 gpg2 --symmetric -o /dev/null < /dev/null
  ... prompted through Emacs ...
  $ unset INSIDE_EMACS
  $ gpg2 --symmetric -o /dev/null < /dev/null
  ... prompted through Emacs, though we expect GUI pinentry ...

This is because gpg-agent is launched on the first call of gpg2 with
INSIDE_EMACS is set, while on the second call, gpg-agent is not told
that INSIDE_EMACS is no longer set, i.e., no "OPTION putenv=..." line is
sent to gpg-agent when the envvar is not set.

I'd suggest to clear INSIDE_EMACS unconditionally on gpg-agent startup
(a trivial patch attached).

Daiki Ueno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-agent-Unset-INSIDE_EMACS-on-gpg-agent-startup.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: </pipermail/attachments/20150615/10ca0ecd/attachment-0001.bin>

More information about the Gnupg-devel mailing list