about summary refs log tree commit diff
path: root/emacs.d/init-functions.el
diff options
context:
space:
mode:
authorVincent Ambo <vincent@spotify.com>2013-07-07T23·39+0200
committerVincent Ambo <vincent@spotify.com>2013-07-07T23·39+0200
commit7e66456fc0926101424e2d064284214464c1e673 (patch)
treeb68ea944cf02c126a0188bc5964be893949f58fb /emacs.d/init-functions.el
parent50ec87400c82e921dd9404672b7e64828abaeca1 (diff)
emacs: Added a function to download a custom script
Diffstat (limited to 'emacs.d/init-functions.el')
-rw-r--r--emacs.d/init-functions.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el
index 5ede8ee7dc1d..c627a5df96d3 100644
--- a/emacs.d/init-functions.el
+++ b/emacs.d/init-functions.el
@@ -1,8 +1,6 @@
 ;; A few handy functions I use in init.el (or not, but they're nice to
 ;; have)
 
-;; Ensure that the themes folder exists
-
 (defun custom-download-theme (url filename)
   "Downloads a theme through HTTP and places it in ~/.emacs.d/themes"
 
@@ -22,6 +20,21 @@
     (unless (file-exists-p file)
       (url-copy-file url file))))
 
+(defun custom-download-script (url filename)
+  "Downloads an Elisp script, places it in ~/.emacs/other and then loads it"
+ 
+  ;; Ensure the directory exists
+  (unless (file-exists-p "~/.emacs.d/other")
+    (make-directory "~/.emacs.d/other"))
+
+  ;; Download file if it doesn't exist.
+  (let ((file
+         (concat "~/.emacs.d/" filename)))
+    (unless (file-exists-p file)
+      (url-copy-file url file))
+
+    (load file)))
+
 
 ;; These come from the emacs starter kit
 (defun esk-pretty-lambdas ()