diff options
author | Tino Calancha <tino.calancha@gmail.com> | 2019-08-22 17:03:17 +0200 |
---|---|---|
committer | Tino Calancha <tino.calancha@gmail.com> | 2019-08-26 03:04:02 +0200 |
commit | cd1c0754ae01b923be193b00a0318fffcc524947 (patch) | |
tree | b0118811c30fc705123c5ea2fba0617d25165d8d /contrib/emacs | |
parent | e93e03705fb5b81f3af85f04c07ad0ee2190b6aa (diff) |
emacs: Prefer to use Emacs builtin customization machinery
Using a customizable variable is the preferred way to set
a parameter within Emacs; replace password-store-timeout with
the new option password-store-time-before-clipboard-restore.
The default value for this variable uses the environment var
PASSWORD_STORE_CLIP_TIME when set; this is the same behavior
as before.
Add Maintainer header.
* contrib/emacs/password-store.el (password-store-password-length):
Increased default value from 8 to 25, i.e. same default as
in the shell script.
(password-store-time-before-clipboard-restore): New option.
(password-store-timeout): Delete it.
Use the new option instead; all callers updated.
* contrib/emacs/CHANGELOG.md: Announce the features.
Diffstat (limited to 'contrib/emacs')
-rw-r--r-- | contrib/emacs/CHANGELOG.md | 7 | ||||
-rw-r--r-- | contrib/emacs/password-store.el | 27 |
2 files changed, 23 insertions, 11 deletions
diff --git a/contrib/emacs/CHANGELOG.md b/contrib/emacs/CHANGELOG.md index f66a355..0be54ab 100644 --- a/contrib/emacs/CHANGELOG.md +++ b/contrib/emacs/CHANGELOG.md @@ -1,3 +1,10 @@ +# 2.0.3 + +* (feature) Update password-store-password-length default value to 25 + +* (feature) Add option password-store-time-before-clipboard-restore; delete + password-store-timeout and use the new option instead. + # 1.0.2 * (bugfix) Fix typo in password-store-url function doc string diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el index a08fec9..9234553 100644 --- a/contrib/emacs/password-store.el +++ b/contrib/emacs/password-store.el @@ -3,7 +3,8 @@ ;; Copyright (C) 2014-2019 Svend Sorensen <svend@svends.net> ;; Author: Svend Sorensen <svend@svends.net> -;; Version: 2.0.2 +;; Maintainer: Tino Calancha <tino.calancha@gmail.com> +;; Version: 2.0.3 ;; URL: https://www.passwordstore.org/ ;; Package-Requires: ((emacs "25") (f "0.11.0") (s "1.9.0") (with-editor "2.5.11")) ;; Keywords: tools pass password password-store @@ -41,11 +42,19 @@ :prefix "password-store-" :group 'password-store) -(defcustom password-store-password-length 8 +(defcustom password-store-password-length 25 "Default password length." :group 'password-store :type 'number) +(defcustom password-store-time-before-clipboard-restore + (if (getenv "PASSWORD_STORE_CLIP_TIME") + (string-to-number (getenv "PASSWORD_STORE_CLIP_TIME")) + 45) + "Number of seconds to wait before restoring the clipboard." + :group 'password-store + :type 'number) + (defvar password-store-executable (executable-find "pass") "Pass executable.") @@ -53,12 +62,6 @@ (defvar password-store-timeout-timer nil "Timer for clearing clipboard.") -(defun password-store-timeout () - "Number of seconds to wait before clearing the password." - (if (getenv "PASSWORD_STORE_CLIP_TIME") - (string-to-number (getenv "PASSWORD_STORE_CLIP_TIME")) - 45)) - (defun password-store--run-1 (callback &rest args) "Run pass with ARGS. @@ -229,7 +232,7 @@ When CALLBACK is non-`NIL', call CALLBACK with the first line instead." Clear previous password from kill ring. Pointer to kill ring is stored in `password-store-kill-ring-pointer'. Password is cleared -after `password-store-timeout' seconds." +after `password-store-time-before-clipboard-restore' seconds." (interactive (list (password-store--completing-read t))) (password-store-get entry @@ -237,9 +240,11 @@ after `password-store-timeout' seconds." (password-store-clear) (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)) + (message "Copied %s to the kill ring. Will clear in %s seconds." + entry password-store-time-before-clipboard-restore) (setq password-store-timeout-timer - (run-at-time (password-store-timeout) nil 'password-store-clear))))) + (run-at-time password-store-time-before-clipboard-restore + nil 'password-store-clear))))) ;;;###autoload (defun password-store-init (gpg-id) |