Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this a proper Emacs (24.3.2) lisp style to load user .el files from .emacs?

Tags:

emacs

elisp

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?

like image 607
Boris Mühmer Avatar asked Jun 22 '13 09:06

Boris Mühmer


1 Answers

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"))
like image 50
Stefan Avatar answered Oct 24 '22 04:10

Stefan