Skip to content

Commit 3db73e3

Browse files
author
Chen Bin
committed
ssh-agent setup
1 parent 749114f commit 3db73e3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lisp/init-misc.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,18 @@ MATCH is optional tag match."
12651265
(kill-new selected)
12661266
(message "\"%s\" => kill-ring" selected))))
12671267

1268+
(defun my-ssh-agency-setup ()
1269+
"Help emacsclient to find ssh-agent setup."
1270+
(when (and (not (getenv "SSH_AGENT_PID"))
1271+
(file-exists-p "~/.ssh/environment"))
1272+
(let* ((str (with-temp-buffer
1273+
(insert-file-contents "~/.ssh/environment")
1274+
(buffer-string))))
1275+
(when (string-match "SSH_AGENT_PID=\\([^ ;]+\\);" str)
1276+
(setenv "SSH_AGENT_PID" (match-string 1 str)))
1277+
(when (string-match "SSH_AUTH_SOCK=\\([^ ;]+\\);" str)
1278+
(setenv "SSH_AUTH_SOCK" (match-string 1 str))))))
1279+
12681280
(defun my-generic-prog-mode-hook-setup ()
12691281
"Generic programming mode set up."
12701282
(when (buffer-too-big-p)

0 commit comments

Comments
 (0)