tweak: make pass buffer display more consistent

This commit is contained in:
Kiana Sheibani 2024-08-14 04:58:33 -04:00
parent d4ecfb0c59
commit f9ed422d0a
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -2526,6 +2526,34 @@ I use the standard Unix-style password management system, [[https://www.password
(set-popup-rule! "^\\*Password-Store" :side 'right :size 0.25 :quit nil)) (set-popup-rule! "^\\*Password-Store" :side 'right :size 0.25 :quit nil))
#+end_src #+end_src
*** Tweaks
For some unknown reason, the creators of the original =pass= package decided that when showing the pass buffer, the main dispatch function would call ~pop-to-buffer~ when it needs to be created, but ~switch-to-buffer~ when it already exists. These are different functions! Let's fix that.
#+begin_src emacs-lisp
(defadvice! ~/pass ()
"Fix inconsistent opening of `pass-mode' buffer."
:override #'pass
(if-let ((window (get-buffer-window pass-buffer-name)))
(progn
(select-window window)
(pass-update-buffer))
(pop-to-buffer pass-buffer-name)
(pass-setup-buffer)))
#+end_src
When visiting a password file, the file's buffer replaces the pass buffer, which isn't very good UX. To fix this, we can advise it to use ~pop-to-buffer~, folding it into the popup system.
#+begin_src emacs-lisp
(defadvice! ~/pass-view ()
"Use `find-file-other-window' instead of `find-file'."
:override #'pass-view
(pass--with-closest-entry entry
(pop-to-buffer
(find-file-noselect (concat (f-join (password-store-dir) entry) ".gpg"))
(cdr (+popup-make-rule nil '(:side bottom :size 8 :quit t :modeline t))))))
#+end_src
* Org * Org
#+call: confpkg() #+call: confpkg()