about summary refs log tree commit diff
path: root/init-functions.el
diff options
context:
space:
mode:
authorvincent@spotify.com <vincent@Vincents-MacBook-Pro.local>2013-08-28T15·16+0200
committervincent@spotify.com <vincent@Vincents-MacBook-Pro.local>2013-08-28T15·16+0200
commit25d348673bd6951e5e9f9235dbd4db311e1a0567 (patch)
tree41754e06a0407f6e83efed578f7b1ed77ad0b23c /init-functions.el
parent73ba15b5a27ac25238fa9df250520d3fb635c747 (diff)
* added circe to package list (*potential* replacement for rcirc)
* added a handy function to retrieve passwords from the OS X keychain
Diffstat (limited to 'init-functions.el')
-rw-r--r--init-functions.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/init-functions.el b/init-functions.el
index 79a9bddc16c4..b461b2e6a720 100644
--- a/init-functions.el
+++ b/init-functions.el
@@ -35,6 +35,17 @@
 
     (load file)))
 
+(defun keychain-password (account &optional keychain)
+  "Returns the password for the account, by default it's looked up in the Login.keychain but a
+   different keychain can be specified."
+  (let ((k (if keychain keychain "Login.keychain")))
+    (replace-regexp-in-string
+     "\n" ""
+     (shell-command-to-string (concat  "security find-generic-password -w -a "
+                                       account
+                                       " "
+                                       k)))))
+
 ;; This clones a git repository to 'foldername in .emacs.d
 ;; if there isn't already a folder with that name
 (defun custom-clone-git (url foldername)