dotfiles-emacs/.emacs.d/init.el
2024-01-03 10:47:27 +01:00

74 lines
2.7 KiB
EmacsLisp

;;;;
;;;;;; -*- Mode: Emacs-Lisp -*-
;;;;
;; 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)
(require 'package)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;; package list to install
(setq package-list '(use-package))
;; activate packages
(package-initialize)
;; fetch list of available packages
(unless package-archive-contents
(package-refresh-contents))
;; install missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
;; 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 c calendar dev functions gpg org pass rust wl yaml))
(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)))))