From 90f95a6a3dd5a95a3df315a9dfcdf8ea94d59104 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 00:16:17 +0200 Subject: Emacs: Added file init-functions.el which I'll use for handy functions --- init-functions.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 init-functions.el diff --git a/init-functions.el b/init-functions.el new file mode 100644 index 000000000000..43d7c81c2fc1 --- /dev/null +++ b/init-functions.el @@ -0,0 +1,23 @@ +;; 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" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) -- cgit 1.4.1