▲ 6 r/emacs
(New to Emacs) Is This the Right Way to Load Packages?
Hey everyone, I’m new to Emacs and Elisp in general. I’ve gone through the documentation to grasp enough basic knowledge of Elisp for setting up my init file. I went with a modularized approach where I load packages from three different folders under the modules directory. Are there any caveats to this setup, or is it fine?
init.el:
;; Loading Modules
(defvar module-list '("modules/config") "List of module")
(mapc (lambda (path)
(add-to-list 'load-path (format "%s%s" user-emacs-directory path))) module-list)
(load "options")
(load "elpaca")
(load "setup-package-archive")
;;Load core package
(setq core-packages (directory-files-recursively (concat user-emacs-directory "modules/core-packages") "\\.el$"))
(mapc (lambda (x) (load-file (format "%s" x))) core-packages)
;;Load external packages
(setq external-packages (directory-files-recursively (concat user-emacs-directory "modules/external-packages") "\\.el$"))
(mapc (lambda (x) (load-file (format "%s" x))) external-packages)
Modules directory:
.
├── config
│ ├── elpaca.el (setup elpaca)
│ ├── options.el
│ └── setup-package.el (source package archives (e.g. Melpa))
├── core-packages
│ ├── dired.el
│ ├── eldoc.el
│ ├── emacs.el
│ ├── erc.el
│ ├── flymake.el
│ ├── isearch.el
│ ├── org-mode.el
│ ├── smerge.el
│ ├── vc.el
│ ├── which-key.el
│ └── window.el
└── external-packages
├── add-node-modules-path.el
├── corfu.el
├── ...
u/Party_Rub9763 — 4 days ago