Skip to content

Commit

Permalink
Add fix-agent function, courtesy of Steve Gilardi.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Dec 4, 2010
1 parent 5c9e3b9 commit d800723
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions starter-kit-defuns.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d800723

Please sign in to comment.