dotfiles-emacs/.emacs.d/init.el

74 lines
2.7 KiB
EmacsLisp
Raw Normal View History

2015-09-19 23:52:34 +02:00
;;;;
;;;;;; -*- Mode: Emacs-Lisp -*-
;;;;
2019-07-10 23:27:54 +02:00
;; package config
;; We want certificate verification for the repositories, see
;; <https://glyph.twistedmatrix.com/2015/11/editor-malware.html> for
;; the issues involved. Note that on Debian, `gnutls-trustfiles' has
;; reasonable settings, so we don't need to customize that.
(setq tls-checktrust t)
(setq gnutls-verify-error t)
(setq tls-program
'("gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h"))
;; Do package initialization now, so we can require packages from config snippets
(setq package-enable-at-startup nil)
2018-05-08 15:50:25 +02:00
(require 'package)
2019-07-10 23:27:54 +02:00
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
2015-09-19 23:52:34 +02:00
2020-08-25 10:53:40 +02:00
;; package list to install
(setq package-list '(use-package))
2018-05-08 15:50:25 +02:00
2019-07-10 23:27:54 +02:00
;; activate packages
(package-initialize)
2018-06-23 13:57:39 +02:00
2020-08-25 10:53:40 +02:00
;; fetch list of available packages
(unless package-archive-contents
(package-refresh-contents))
2019-07-10 23:27:54 +02:00
2020-08-25 10:53:40 +02:00
;; install missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
2019-07-10 23:27:54 +02:00
;; configure packages (taken from https://r0tty.org/git/dotfiles/emacs)
(require 'use-package)
;; Config snippets loading; this provides an easy way to define
;; 'configuration snippets' for use with a specific package (that may
;; be not installed), and enable loading that snippet when its
;; basename (specified as a symbol) is part of the variable
;; config-snippets.
(defgroup config-snippets nil
"Configuration snippets -- elisp files that are loaded at startup.")
(defcustom config-snippets '()
"Specifies the config snippets to be loaded at startup.
Elements may be strings (interpreted as literal filenames) or
symbols, which are converted to strings, and suffixed with \".el\"."
:group 'config-snippets
:type '(repeat (choice symbol string)))
(defcustom config-snippet-path '("~/.emacs.d/config/")
"Specifies the path in which config snippets are searched"
:group 'config-snippets
:type '(repeat directory))
(setq config-snippets '(base backups calendar dev functions gpg matrix org pass wl))
2019-07-10 23:27:54 +02:00
(message "Loading\nconfig-snippets: %s\nconfig-snippets-path: %s" config-snippets config-snippet-path)
(dolist (snippet config-snippets)
(message "snippet: %s" snippet)
(dolist (dir config-snippet-path)
(message "dir: %s" dir)
(let ((file-name (expand-file-name (concat dir (if (symbolp snippet)
(concat (symbol-name snippet) ".el")
snippet)))))
(message "loading file")
(if (file-readable-p file-name)
(load-file file-name)
(message "Config snippet not found: %s" snippet)))))