From d13ff1f3a7407d18eb92703b052cfd984e8882f3 Mon Sep 17 00:00:00 2001 From: John Turner Date: Thu, 22 Dec 2022 21:34:40 -0500 Subject: [PATCH] added require? macro for requring optional libraries --- init.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index afbab3c..775494f 100644 --- a/init.el +++ b/init.el @@ -29,8 +29,12 @@ (add-to-list 'load-path directory)) directories)) -(when (locate-library "site-gentoo") - (require 'site-gentoo)) +(defmacro require? (feature) + `(require ,feature nil t)) + +(require? 'site-gentoo) + +(require? 'magit) (require 'init-text-mode) (require 'init-conf-mode) @@ -54,16 +58,16 @@ (require 'init-savehist) (require 'init-tramp) -(when (locate-library "company") +(when (require? 'company) (require 'init-company)) -(when (locate-library "eglot") +(when (require? 'eglot) (require 'init-eglot)) -(when (locate-library "flycheck") +(when (require? 'flycheck) (require 'init-flycheck)) -(when (locate-library "lsp-mode") +(when (require? 'lsp-mode) (require 'init-lsp-mode)) (when (and (> emacs-major-version 28) (native-comp-available-p))