Clearing clipboard contents with password-store.el

Gustavo Barros gusbrs.2016 at gmail.com
Tue Sep 8 18:45:33 CEST 2020


Hi All,

I've been trying out pass and so far I'm really enjoying it.  In 
particular,
as I use Emacs, I'm experimenting with the package password-store.el.

However, and perhaps I'm getting something wrong, as I'm new to both 
programs,
while password-store.el does clear the secret stored in the kill-ring, 
it does
not clear the system's clipboard, which Emacs uses in case it exists.

As far as I tried, I copied a password from the store with
`password-store-copy', waited to get the message that it had been 
cleared.
Examining the kill-ring, it is indeed not there any longer. But, if
I go to another program, let's say gedit, I can still copy the password 
from
the clipboard.  I also tested this with `emacs -Q' to be sure my config 
wasn't
somehow responsible for this.

Am I correct in assuming this is not expected behavior?  If I'm not, 
what
would be the proper procedure to use password-store.el so that the 
secret is
not left hanging in the clipboard?

I've checked `password-store.el' and saw the function responsible for 
this
task is `password-store-clear'.  Indeed, as far as I can tell, it does 
not
seem to handle the clipboard at all.  So, I've redefined/patched this 
function
to add:

  (let ((save-interprogram-paste-before-kill nil))
    (kill-new ""))

to an appropriate place in that function, and it does seem to handle the
issue, in that the clipboard gets cleared alongside the kill-ring, but 
the
empty string does not really taints the kill-ring itself (it appears to
ignore the empty string).

Anyway, if this is indeed an issue, and if this solution is appropriate, 
I'd
love to see it upstream.  If it is not, I'd be thankful to hear your
suggestions.

Thanks!

Best,
Gustavo.


More information about the Password-Store mailing list