diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2025-03-08 11:33:59 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2025-03-08 18:25:11 -0500 |
commit | c705bfdb039d22f26dea76230eae9904e7082133 (patch) | |
tree | be1c61ddaeb8653931a711c831f132c92bd72972 /emacs | |
parent | 5e4e48c35780fbce329b7329ddafe0a27c961d2a (diff) |
Add utilities to transient menu
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.config/emacs/emacs-custom.el | 3 | ||||
-rw-r--r-- | emacs/.config/emacs/init.el | 56 |
2 files changed, 46 insertions, 13 deletions
diff --git a/emacs/.config/emacs/emacs-custom.el b/emacs/.config/emacs/emacs-custom.el index 84f24d4..29c4e38 100644 --- a/emacs/.config/emacs/emacs-custom.el +++ b/emacs/.config/emacs/emacs-custom.el @@ -9,7 +9,8 @@ '(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 3) + '((checkdoc-allow-quoting-nil-and-t . t) + (eval outline-hide-sublevels 3) (eval outline-hide-sublevels 2) (Package . CL-WHO) (Package . HUNCHENTOOT) diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el index 94472c3..2089701 100644 --- a/emacs/.config/emacs/init.el +++ b/emacs/.config/emacs/init.el @@ -458,7 +458,7 @@ (use-package emacs :ensure nil :init - (load-theme 'deeper-blue)) + (load-theme 'modus-operandi)) (use-package doom-themes) @@ -502,6 +502,19 @@ ;;;; My Utilities ;;;;; Pass integration +(defun kj/pass-buffer () + (get-buffer-create "*pass*")) + +(defun kj/pass-echo (message) + (with-current-buffer (kj/pass-buffer) + (goto-char (point-max)) + (insert (propertize (concat message "\n") + 'face 'bold)))) + +(defun kj/pass-process (command &rest args) + (kj/pass-echo (format "$ %s" (string-join (cons command args) " "))) + (apply #'start-process "pass" (kj/pass-buffer) command args)) + (defun kj/list-passwords () (let* ((path (expand-file-name "~/.password-store")) (pred (lambda (p) @@ -513,15 +526,27 @@ (passwords (mapcar extract files))) passwords)) -(defun kj/pass () +(defun kj/pass-to-clipboard () (interactive) (let* ((password (completing-read "Password: " (kj/list-passwords))) - (process (start-process "pass" - (get-buffer-create " *pass*") - "pass" "show" "-c" password)) + (process (kj/pass-process "pass" "show" "-c" password)) (filter (lambda (proc m) (message "%s" (string-trim m))))) (set-process-filter process filter))) +(defun kj/pass-show () + (interactive) + (let* ((password (completing-read "Password: " (kj/list-passwords)))) + (kj/pass-echo "Showing password") + (kj/pass-process "pass" "show" password) + (display-buffer (kj/pass-buffer)))) + +(require 'with-editor) +(defun kj/pass-edit () + (interactive) + (let ((password (completing-read "Edit password: " (kj/list-passwords)))) + (with-editor + (kj/pass-process "pass" "edit" password)))) + (keymap-global-set "C-c p" #'kj/pass) (defun kj/transient-command (&optional args) @@ -535,13 +560,20 @@ (transient-define-prefix kj/transient () "KJ Transient" - ["Arguments" - ("-s" "Switch" "--switch") - ("-a" "Another switch" "--another") - ("-m" "Argument test" "--message=")] - ["Actions" - ("d" "Action d" kj/transient-command)])) - + [;; "Arguments" + ;; ("-s" "Switch" "--switch") + ;; ("-a" "Another switch" "--another") + ;; ("-m" "Argument test" "--message=") + ] + ["Pass" + ("c" "Clipboard" kj/pass-to-clipboard) + ("s" "Show" kj/pass-show) + ("e" "Edit" kj/pass-edit)] + ["Repositories" + ("l" "List Repositories" magit-list-repositories) + ("C" "Clone my project" kj/clone-project)])) + +(keymap-global-set "C-c m" #'kj/transient) ;;;; Applications ;;;;; Tramp |