Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add fix-agent function, courtesy of Steve Gilardi.

  • Loading branch information...
commit d800723f44a57bb688a1574887add5422745ca6b 1 parent 5c9e3b9
@technomancy authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 starter-kit-defuns.el
View
19 starter-kit-defuns.el
@@ -229,6 +229,25 @@ Symbols matching the text at point are put first in the completion list."
(interactive)
(insert "ಠ_ಠ"))
+(defun esk-agent-path ()
+ (if (eq system-type 'darwin)
+ "*launch*/Listeners"
+ "*ssh*/agent\.*"))
+
+(defun esk-find-agent ()
+ (let* ((path-clause (format "-path \"%s\"" (esk-agent-path)))
+ (find-command (format "$(find -L /tmp -uid $UID %s -type s 2> /dev/null)"
+ path-clause)))
+ (first (split-string
+ (shell-command-to-string
+ (format "/bin/ls -t1 %s | head -1" find-command))))))
+
+(defun fix-agent ()
+ (interactive)
+ (let ((agent (esk-find-agent)))
+ (setenv "SSH_AUTH_SOCK" agent)
+ (message agent)))
+
(defun toggle-fullscreen ()
(interactive)
;; TODO: this only works for X. patches welcome for other OSes.
Please sign in to comment.
Something went wrong with that request. Please try again.