aboutsummaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Tom Willemse2016-07-24 01:10:37 +0200
committerGravatar Tom Willemse2016-07-24 01:10:37 +0200
commitff7157d1b2868ca6752123fafefb7db3fc03b6b6 (patch)
tree4d29687a899c9c35dfb3e51be529d51576a99fcd /emacs
parent295117cb5e5497a98218986aaa11d0a144b95b9c (diff)
downloadnew-dotfiles-ff7157d1b2868ca6752123fafefb7db3fc03b6b6.tar.gz
new-dotfiles-ff7157d1b2868ca6752123fafefb7db3fc03b6b6.zip
Add some packages
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.el61
1 files changed, 61 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
index f0bbbf5..bfdf935 100644
--- a/emacs/.emacs.d/init.el
+++ b/emacs/.emacs.d/init.el
@@ -26,6 +26,49 @@
;;; Code:
+;;;; Package configuration:
+;;; Require package.el since we immediately start using its variables
+;;; and functions anyway, no need to delay loading.
+(require 'package)
+
+;; Add the MELPA and org package archives because I like living on the
+;; bleeding edge. This should be done both at run-time and
+;; compile-time so I can install packages at compile time.
+(eval-and-compile
+ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
+ (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")))
+
+;; Initialize package.el so that packages can be loaded and used. This
+;; also needs to be done at both run-time and compile-time so packages
+;; can be installed at compile-time.
+(eval-and-compile (package-initialize))
+
+;; Refresh the package contents so packages can be installed from all
+;; configured archives. Don't do this at run-time because it slows
+;; down the process too much.
+(eval-when-compile (package-refresh-contents))
+
+;; This macro is inspired by use-package, but I want to maintain some
+;; control of the syntax I use to configure my settings.
+(defmacro ensure-package (package &rest args)
+ "Make sure PACKAGE is installed.
+
+ARGS should be a plist which may contain one of the following options:
+
+- :from
+
+ Specify which package should actually be installed to ensure
+ the library named in PACKAGE exists."
+ (let ((library-symbol (cl-gensym))
+ (package-symbol (cl-gensym)))
+ `(eval-when-compile
+ (let ((,library-symbol ',package)
+ (,package-symbol ',(or (plist-get args :from) package)))
+ (unless (and (package-installed-p ,package-symbol)
+ (locate-library (symbol-name ,library-symbol)))
+ (package-install ,package-symbol))
+ (require ,library-symbol)))))
+
;;;; Helper functions:
;; I have noticed that I refer to the combination of
@@ -107,5 +150,23 @@ This is currently the data directory under the
;; whereabouts I am, so they just take up space.
(scroll-bar-mode -1)
+;;;; Minor modes:
+
+;;;;; Paredit:
+
+(ensure-package paredit)
+
+;;;; Major modes:
+
+;;;;; Scheme mode:
+
+(add-hook 'scheme-mode-hook 'paredit-mode)
+
+;;;; Applications:
+
+;;;;; Magit:
+
+(ensure-package magit)
+
(provide 'init)
;;; init.el ends here