1

As far as I understand libraries can define a default.el file that will be loaded on startup. I would like to run librarie's default.el, but not the init file of the user (e.g. in .emacs/init.el). Is it possible somehow to do that? I tried to start emacs with -q but it will not load the libraries at all. I also tried -u fakeuser and it kind of work except that I get an error about a non existant user fakeuser (of course).

3 Answers 3

1

C-hig (emacs)Init File says:

‘default.el’ ... is loaded whenever you start Emacs (except when you specify ‘-q’). But your init file, if any, is loaded first; if it sets ‘inhibit-default-init’ non-‘nil’, then ‘default’ is not loaded.

So the same -q option which inhibits your init file also inhibits default.el. You therefore do need to also load it explicitly on the command line.

The simplest way to do this is with the -l option:

emacs -q -l default
0

I believe that emacs -q does this (whereas emacs -Q doesn't load either your init file or default.el or site-lisp.el).

See the Emacs manual, node Initial Options.

Oops, I guess that's not correct. Apparently default.el is not loaded with option -q: see node Init File.

But you might give it a try. File default.el doesn't exist, by default. Someone has to create it. If you have edit access to site-lisp.el then you could maybe do what you had intended for default.el there instead.

Or maybe (hopefully) someone else has a proper answer: how to get both site-lisp.el and default.el, but not your init file, loaded at startup.

2
  • Thanks. Oh I thought that each library was free to define its own default.el/site and that emas would charge them all… and in fact there is a single library/file with this name. But I'm using home manager that does create a default file for me (i could certainly put that in site, but then since there is a single site file I guess I will need to edit a file own by root or at least find an elegant way to merge these files and I don't really like that). Acually, can I use maybe -q --eval XX to start the default file? If yet what should I put in XX ?
    – tobiasBora
    Sep 21, 2022 at 22:43
  • Hum I tried to run ` emacs -q --eval '(load-library "default.el")'` and it seems to kind of work. I'm just not sure why it does not starts the splash screen in that case while it does if I start it without -q. Is it supposed to be strictly equivalent?
    – tobiasBora
    Sep 21, 2022 at 22:53
0

I tried to do

emacs -q --eval '(load-library "default.el")'

and it seems to work… I am not sure though if it is strictly equivalent (maybe the libraries are loaded before default.el instead of after… if you have more information let me know)

3
  • 2
    Was that different to emacs -q -l default ?
    – phils
    Sep 21, 2022 at 23:02
  • 1
    @phils Oh this is quicker indeed and seems to work similarly. If you want you can add your own answer that I can accept.
    – tobiasBora
    Sep 21, 2022 at 23:10
  • Sure; done (if not quite immediately).
    – phils
    Jun 19 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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