1

I am having trouble telling Emacs to load and evaluate an additional .el file which only contains some lisp code to load an org file

;; keep my personal settings not in the .emacs file
;; http://www.mygooglest.com/fni/dot-emacs.html
;; load it if it exists
(let ((personal-settings "~/personal.el"))
 (when (file-exists-p personal-settings)
   (load-file personal-settings))
)

If I call the file personal.el interactively via load-file Emacs executes the code (which just contains some lisp code to load an org file).

If I run M-X eval-buffer on the .emacs manually, the personal.el is executed properly, the org file is loaded.

What do I need to do to make Emacs load the file if it exists during emacs start?

EDIT

I rephrased the question and ran additional tests: (expand-file-name) did not have any effect but more weird is that Emacs does not evaluate a hard-coded (find-file "~/Dropbox/orgmode.org") even if it is the only line in my .emacs file. And again it works if I load this file manually and run m-x eval-buffer on it.

3
  • 2
    You're missing a question: your description basically says that if you load the file it works. Great, so what's the problem? – Stefan Aug 5 '17 at 22:56
  • What @Stefan said. Also, you might want to consider putting the file in a directory in your load-path and using require or load-library. – Drew Aug 6 '17 at 1:04
  • Does it work if you call (expand-file-name) before calling load-file? The ~ may need to be substituted. – InHarmsWay Aug 6 '17 at 4:33
2

Mystery solved, it's a bit embarrassing: Emacs is doing fine but just showing the startup-screen as first buffer. Disabling it via (setq inhibit-startup-screen t)? does the trick...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.