From 1e0976215cb33ce8658f3b79b79bc846856b71a6 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 16 Aug 2023 14:10:49 -0400 Subject: [PATCH] Configure auth-source-pass --- .emacs.d/init.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 74a7b2b..89fb362 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -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