path: root/contrib
diff options
authorSvend Sorensen <svend@ciffer.net>2014-05-16 13:37:43 -0700
committerSvend Sorensen <svend@ciffer.net>2014-06-16 11:41:58 -0700
commit2817aeb73ad5086e92fb1bf5e3ba8bb6a4040cb6 (patch)
treedc7402d59b2329a2ef12c601149b16ef43869377 /contrib
parentemacs: Use when instead of if/progn (diff)
emacs: Use PASSWORD_STORE_CLIP_TIME env variable
Timeout password after PASSWORD_STORE_CLIP_TIME seconds, if set. Otherwise timeout after 45 seconds. These are the setting used by pass.
Diffstat (limited to 'contrib')
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 4bfa290..cdecad4 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -42,8 +42,11 @@
(defconst password-store-password-length 8
"Default password length.")
-(defconst password-store-timeout 45
- "Number of seconds to wait before clearing the password.")
+(defun password-store-timeout ()
+ "Number of seconds to wait before clearing the password."
+ (string-to-number (getenv "PASSWORD_STORE_CLIP_TIME"))
+ 45))
(defun password-store--run (&rest args)
"Run pass with ARGS.
@@ -181,8 +184,8 @@ after `password-store-timeout' seconds."
(kill-new password)
(setq password-store-kill-ring-pointer kill-ring-yank-pointer)
- (message "Copied %s to the kill ring. Will clear in %s seconds." entry password-store-timeout)
- (run-at-time password-store-timeout nil 'password-store-clear)))
+ (message "Copied %s to the kill ring. Will clear in %s seconds." entry (password-store-timeout))
+ (run-at-time (password-store-timeout) nil 'password-store-clear)))
(defun password-store-init (gpg-id)