Best way (and examples) to make a tidy config with multiple files? reddit / emacs ---------------------------------------------------------------------- cidra_ · 2022-06-11 14:49 Hi all. As title says, I'd like to make a config using multiple files to make it more readable (at least for me). I don't want to do a literate config nor using use-package: just package and simple stuff like require and load. ​ ​ I've seen [this config repo](https://github.com/bling/dotemacs) which is really cool and easy to read and basically works this way: the init files does some preliminary stuff, then loads all the files in the /core and /config directory. I've seen that if i compile the byte code of the scripts in /config by themselves, there are some warnings of variables and functions not defined. The included files do not have explicit dependencies because everything is automatically included by the init file. ​ So the question is: is there a better approach on structuring an emacs config among multiple files? ---------------------------------------------------------------------- X7and7 · 2022-06-11 15:47 I feel your pain, my config is so messed up right now :( ---------------------------------------------------------------------- nv-elisp · 2022-06-11 16:21 In what way does the number of files impact readability? ---------------------------------------------------------------------- cidra_ · 2022-06-11 16:34 Having everything in one file certainly does ---------------------------------------------------------------------- nv-elisp · 2022-06-11 16:38 How? ---------------------------------------------------------------------- cidra_ · 2022-06-11 16:45 Because It's too cluttered. I'd like to distinguish between default settings and specific mode settings (that could override some of the default settings) for example ---------------------------------------------------------------------- Hastrack · 2022-06-11 18:17 I write my entire config in a org file that gets tangled to various .el modules that get loaded by the init.el file. I've been using Emacs for 2 years and that's the approach I liked the most. ---------------------------------------------------------------------- onetom · 2022-06-12 09:14 I simply.add a lib/ directory to the load-path and require my other config files like that. to make this work, u have to put a (provide 'package-name) to the end of your required files: https://github.com/onetom/onetomacs/blob/main/lib/init-visuals.el#L57 I don't care about before/after-load functionality, since I don't load many order-sensitive packages, so I can just order them manually. ---------------------------------------------------------------------- colemaker360 · 2022-06-12 13:44 Have a look at Purcell’s (extremely popular) config: https://github.com/purcell/emacs.d I don’t use it anymore, but I use the model of a lisp directory for includes and it works great. You just have to provide each include with `(provide 'init-git)`, and then you can require it in init.el `(require 'init-git)`. It’s a very elegant solution. The System Crafters Rational Emacs distro takes the same approach as Purcell too: https://github.com/SystemCrafters/rational- emacs/tree/master/modules ---------------------------------------------------------------------- theMachine0094 · 2022-06-14 18:29 I have a lisp folder with several .el files. They all "provide" various packages and features. I "require" them in the main init file. This also allows me to control what's included. For example on my laptop I skip some of the .El files because I don't need them (as opposed to my workstation or the work computer).