doomemacs/modules/tools/pass/config.el
Henrik Lissner 82ae3a73f3
def-advice!->defadvice! & conform to new advice conventions
This commit does two things:

- Renames def-advice! to defadvice!, in the spirit of naming convenience
  macros after the function/macro they enhance or replace.
- Correct the names of advice functions to indicate visibility and
  intent. A public advice function like doom-set-jump-a is meant to be
  used elsewhere. A private one like +dired--cleanup-header-line-a
  shouldn't -- it likely won't work anywhere but the function(s) it was
  made to advise.
2019-07-23 17:24:56 +02:00

40 lines
1.2 KiB
EmacsLisp

;;; tools/pass/config.el -*- lexical-binding: t; -*-
(defvar +pass-user-fields '("login" "user" "username" "email")
"A list of fields for `+pass/ivy' to search for the username.")
(defvar +pass-url-fields '("url" "site" "location")
"A list of fields for `+pass/ivy' to search for the username.")
;;
;; Packages
;; `password-store'
(setq password-store-password-length 12)
;; Fix hard-coded password-store location; respect PASSWORD_STORE_DIR envvar
(defadvice! +pass--respect-pass-dir-envvar-a (entry)
"Return a string with the file content of ENTRY."
:override #'auth-source-pass--read-entry
(with-temp-buffer
(insert-file-contents
(expand-file-name (format "%s.gpg" entry) (password-store-dir)))
(buffer-substring-no-properties (point-min) (point-max))))
;; `pass'
(after! pass
(set-evil-initial-state! 'pass-mode 'emacs)
(set-popup-rule! "^\\*Password-Store" :side 'left :size 0.25 :quit nil)
(define-key! pass-mode-map
"j" #'pass-next-entry
"k" #'pass-prev-entry
"d" #'pass-kill
"\C-j" #'pass-next-directory
"\C-k" #'pass-prev-directory))
;; Is built into Emacs 26+
(when (and EMACS26+ (featurep! +auth))
(auth-source-pass-enable))