Configure auth-source-pass

This commit is contained in:
Adam Goldsmith 2023-08-16 14:10:49 -04:00
parent 3d75bee174
commit 1e0976215c
1 changed files with 13 additions and 0 deletions

View File

@ -336,6 +336,19 @@
(add-hook 'yaml-mode-hook
(lambda () (setq-local show-trailing-whitespace t))))
(use-package auth-source-pass :demand
:config
(auth-source-pass-enable)
(defun auth-source-pass--remap (orig-fun host &optional user port)
(let ((new-host (pcase host
("hosting" "hosting.tardisventures.net")
(_ host)))
(new-user (if (string= port "sudo") (user-login-name) user)))
(message "remapped %s@%s:%s -> %s@%s:%s" host user port new-host new-user port)
(funcall orig-fun new-host new-user port)))
(advice-add 'auth-source-pass--find-match-unambiguous :around #'auth-source-pass--remap))
(use-package calc
:bind ("C-x M-e" . calc-eval-in-place)
:init