fix(pass): enable evil-collection bindings

- Pass was launched in emacs-state because evil-collection didn't
  support pass when the module was written, but it does now.
- It also removes stale code relative to the PASSWORD_STORE_DIR
  environment variable, since the password store path is not hardcoded in
  pass.el anymore.
This commit is contained in:
edgar-vincent 2022-07-23 13:59:43 +00:00 committed by GitHub
parent b636d9e793
commit d15022d4fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,25 +13,19 @@
;;;###package password-store ;;;###package password-store
(setq password-store-password-length 12) (setq password-store-password-length 12)
;; Fix hard-coded password-store location; respect PASSWORD_STORE_DIR envvar (after! evil-collection-pass
(defadvice! +pass--respect-pass-dir-envvar-a (entry) ;; FIXME This needs to be upstreamed to evil-collection.
"Return a string with the file content of ENTRY." (add-to-list 'evil-collection-pass-command-to-label '(pass-update-buffer . "gr")))
: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))))
(after! pass (after! pass
(set-evil-initial-state! 'pass-mode 'emacs) (set-evil-initial-state! 'pass-mode 'normal)
(set-popup-rule! "^\\*Password-Store" :side 'left :size 0.25 :quit nil) (set-popup-rule! "^\\*Password-Store" :side 'left :size 0.25 :quit nil)
(define-key! pass-mode-map (map! :map pass-mode-map
"j" #'pass-next-entry :n "j" #'pass-next-entry
"k" #'pass-prev-entry :n "k" #'pass-prev-entry
"d" #'pass-kill :n "d" #'pass-kill
"\C-j" #'pass-next-directory :n "C-j" #'pass-next-directory
"\C-k" #'pass-prev-directory)) :n "C-k" #'pass-prev-directory))
;; Is built into Emacs 26+ ;; Is built into Emacs 26+