Add some packages

This commit is contained in:
Tom Willemse 2016-07-24 01:10:37 +02:00
parent 295117cb5e
commit ff7157d1b2

View file

@ -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