diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2025-03-06 21:13:59 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2025-03-06 21:13:59 -0500 |
commit | 7cfd7a6d3cc666d8701780fe30e3200a4f308d81 (patch) | |
tree | b38a41d49bf70551ff288ebc7dc1692b44f15f32 | |
parent | 886829ba97806afe5931197849fbbb289144057a (diff) |
Add pass utility
-rw-r--r-- | emacs/.config/emacs/emacs-custom.el | 8 | ||||
-rw-r--r-- | emacs/.config/emacs/init.el | 24 |
2 files changed, 29 insertions, 3 deletions
diff --git a/emacs/.config/emacs/emacs-custom.el b/emacs/.config/emacs/emacs-custom.el index fe5fa00..84f24d4 100644 --- a/emacs/.config/emacs/emacs-custom.el +++ b/emacs/.config/emacs/emacs-custom.el @@ -4,11 +4,13 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-safe-themes - '("0340489fa0ccbfa05661bc5c8c19ee0ff95ab1d727e4cc28089b282d30df8fc8" "e3999eba4f25d912d7d61cbaaed1b551957e61da047279da89499d3bd1f1d007" "8d412c0ed46b865312d6df5c1dfd1821d349dd3cba00049cf88c4ad34403597e" "88267200889975d801f6c667128301af0bc183f3450c4b86138bfb23e8a78fb1" default)) + '("fbf73690320aa26f8daffdd1210ef234ed1b0c59f3d001f342b9c0bbf49f531c" "0340489fa0ccbfa05661bc5c8c19ee0ff95ab1d727e4cc28089b282d30df8fc8" "e3999eba4f25d912d7d61cbaaed1b551957e61da047279da89499d3bd1f1d007" "8d412c0ed46b865312d6df5c1dfd1821d349dd3cba00049cf88c4ad34403597e" "88267200889975d801f6c667128301af0bc183f3450c4b86138bfb23e8a78fb1" default)) '(package-selected-packages - '(dslide org-download anki-editor yasnippet org-pomodoro eshell-syntax-highlighting esh-help pcmpl-args exercism tidal haskell-mode diff-hl dts-mode clojure-mode unobtrusive-magit-theme ledger-mode nix-mode rustic tempel puni magit gcmh smudge helpful pdf-tools pcre2el repeat-help selected ace-mc expand-region idle-highlight-mode diredfl anzu direnv ob-async mixed-pitch deadgrep wgrep coterm doom-themes with-editor zenburn-theme yasnippet-snippets yaml-mode which-key undo-tree tabbar session rust-mode puppet-mode pod-mode notmuch muttrc-mode mutt-alias lsp-mode initsplit ido-completing-read+ htmlize graphviz-dot-mode goto-chg gitignore-mode gitconfig-mode gitattributes-mode git-modes folding flycheck ess eproject editorconfig diminish csv-mode color-theme-modern browse-kill-ring boxquote bm bar-cursor apache-mode projectile embark-consult)) + '(modus-themes kj-emacs dslide org-download anki-editor yasnippet org-pomodoro eshell-syntax-highlighting esh-help pcmpl-args exercism tidal haskell-mode diff-hl dts-mode clojure-mode unobtrusive-magit-theme ledger-mode nix-mode rustic tempel puni magit gcmh smudge helpful pdf-tools pcre2el repeat-help selected ace-mc expand-region idle-highlight-mode diredfl anzu direnv ob-async mixed-pitch deadgrep wgrep coterm doom-themes with-editor zenburn-theme yasnippet-snippets yaml-mode which-key undo-tree tabbar session rust-mode puppet-mode pod-mode notmuch muttrc-mode mutt-alias lsp-mode initsplit ido-completing-read+ htmlize graphviz-dot-mode goto-chg gitignore-mode gitconfig-mode gitattributes-mode git-modes folding flycheck ess eproject editorconfig diminish csv-mode color-theme-modern browse-kill-ring boxquote bm bar-cursor apache-mode projectile embark-consult)) + '(package-vc-selected-packages '((kj-emacs :url "/home/orbekk/git/kj-emacs.git"))) '(safe-local-variable-values - '((eval outline-hide-sublevels 2) + '((eval outline-hide-sublevels 3) + (eval outline-hide-sublevels 2) (Package . CL-WHO) (Package . HUNCHENTOOT) (Base . 10) diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el index b82905a..ad0d924 100644 --- a/emacs/.config/emacs/init.el +++ b/emacs/.config/emacs/init.el @@ -495,6 +495,30 @@ (rename-buffer (kj/shell-buffer-name))))) +;;;; My Utilities +;;;;; Pass integration +(defun kj/list-passwords () + (let* ((path (expand-file-name "~/.password-store")) + (pred (lambda (p) + (not (string-search (concat path "/.git") p)))) + (files (directory-files-recursively path "\\.gpg$" t pred t)) + (extract (lambda (p) + (string-remove-prefix (concat path "/") + (string-remove-suffix ".gpg" p)))) + (passwords (mapcar extract files))) + passwords)) + +(defun kj/pass () + (interactive) + (let* ((password (completing-read "Password: " (kj/list-passwords))) + (process (start-process "pass" + (get-buffer-create " *pass*") + "pass" "show" "-c" password)) + (filter (lambda (proc m) (message "%s" (string-trim m))))) + (set-process-filter process filter))) + +(keymap-global-set "C-c p" #'kj/pass) + ;;;; Applications ;;;;; Tramp (use-package tramp :ensure nil) |