I have several .el files within my "~/.emacs.d" directory and I added the following lines to my .emacs file to load them at startup:
(let ((base "~/.emacs.d/")
(files '("user.el" "erlang.el" "sbcl-slime.el"))
(bfload (lambda (file) (load (expand-file-name (concat base file))))))
(mapcar bfload files))
It works, but is this proper Emacs Lisp style? How can this be improved, please?
First, don't put your .el files directly into ~/.emacs.d (Emacs puts various files in there, and they're not expected to be Elisp packages). You can put them into ~/.emacs.d/pkgs
for example, instead.
How 'bout:
(dolist (file '("user.el" "erlang.el" "sbcl-slime.el"))
(load (expand-file-name file "~/.emacs.d/pkgs"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With