Hi all,

I've been using ivy-pass, the emacs password-store client, recently
and it's been great. I wrote a PR to it that for an action which lists
all the fields of the selected entry *except* the password, and the
selected one is then copied. Sometimes it's useful to copy out just
the security code for a bank, or an api key or whatever, which is
stored in the same file as the main password for that service.

PR: <https://github.com/ecraven/ivy-pass/pull/6>

Of course, since the default action is to copy the password (the top
field in the file) of the given entry, I never use this function to
copy the password. I also never use it to copy the username, since I
have a function specifically for copying the username (part of the
same PR). To increase efficiency then it would be useful to exclude
these fields from the menu for that function.

Given the way the function is written, leveraging the
password-store.el library, this would have to be a change to that
library. This patch is that change: add a customizable variable
`password-store-read-ignore-fields', which is a list of strings, and
possibly the symbol `secret'. Defaults to an empty list.

Accordingly, modify `password-store-read-field' such that it does not
present any of the fields with names in this list as candidates. If
`secret' appears then it does not present the password. The use of
this is explained in a docstring.

Since the variable defaults to emptyf, this shouldn't break anything
for anyone already using the library, put might be useful for some
other people out there. I certainly notice it being useful every
couple of days.

```patch
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 61c339e..b2480d6 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -59,6 +59,29 @@
   :group 'password-store
   :type 'string)

+(defcustom password-store-read-ignore-fields '()
+ "List of field names to ignore when prompting for field in the minibuffer.
+ 
+Include the symbol secret to exclude the password itself. All
+other fields are excluded by including a string of the name of
+the field. E.g. to exclude the password and the url field set it
+to `(secret \"url\")'.
+ 
+This is useful because such minibuffer prompts are generally used to
+access fields which could _not_ be accessed otherwise (those other
+than the password itself, the `username' field, etc.). Setting this
+variable can exclude those fields from the list, making it quicker to
+select what you need.
+ 
+This can be especially powerful if you use a completion mechanism
+which can be configured to select the last candidate
+automatically. Few entries ever have more than three fields, two
+of which are normally very common (the secret and the username or
+url). Excluding these would then select the third automatically."
+ :group 'password-store
+ :type '(restricted-sexp :match-alternatives
+ (secret stringp)))
+ (defvar password-store-executable
    (executable-find "pass")
    "Pass executable.")
@@ -207,8 +230,9 @@ ENTRY is the name of a password-store entry."
 (defun password-store-read-field (entry)
   "Read a field in the minibuffer, with completion for ENTRY."
   (let* ((inhibit-message t)
- (valid-fields (mapcar #'car (password-store-parse-entry entry))))
- (completing-read "Field: " valid-fields nil 'match)))
+ (valid-fields (mapcar #'car (password-store-parse-entry entry)))
+ (relevant-fields (seq-difference valid-fields password-store-read-ignore-fields)))
+ (completing-read "Field: " relevant-fields nil 'match)))

  (defun password-store-list (&optional subdir)
    "List password entries under SUBDIR."

```

Hope this helps someone.

Blue skies, Hugo
