From 23641ca5c2570a46d30496ca678b8d4ba0259b28 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Sun, 6 Aug 2023 00:46:08 -0700 Subject: [PATCH] feat: add convenient `config-download` function Signed-off-by: Lucas Sta Maria --- .emacs.d/include/misc.el | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.emacs.d/include/misc.el b/.emacs.d/include/misc.el index bb3987f..52ca981 100644 --- a/.emacs.d/include/misc.el +++ b/.emacs.d/include/misc.el @@ -9,11 +9,40 @@ (require 'elfeed) (require 'neotree) -(defun config-recompile () - "Recompile the current Emacs configuration." +(defun config-compile () + "(Re)compile the current Emacs configuration." (interactive) (byte-recompile-directory "~/.emacs.d/")) +(defun config-download (&optional confirm) + "Download the latest Emacs configuration files from the GitHub repository." + (interactive) + (let* ((confirm (or confirm + (read-string "Type `YES' to confirm download: ")))) + (if (not (string= confirm "YES")) + (print "Cancelling config download/update...") + (let* ((gh-url "https://raw.githubusercontent.com/priime0/dotfiles/master/.emacs.d/") + (target-dir "~/temp/.emacs.d/") + (filenames + '("init.el" + "include/general.el" + "include/misc.el" + "include/racket.el" + "include/pdfconfig.el" + "include/cppconfig.el" + "include/latexconfig.el" + "include/mu4econfig.el" + "include/orgconfig.el")) + (file-paths (mapcar (lambda (s) (concat target-dir s)) + filenames)) + (file-urls (mapcar (lambda (s) (concat gh-url s)) + filenames)) + (file-path-urls (lists->alist file-paths file-urls))) + (mkdir (concat target-dir "include") t) + (mapc (lambda (f) + (url-copy-file (cdr f) (car f) t)) + file-path-urls))))) + ;; Git Gutter (global-git-gutter-mode +1)