0

So, here is my init.el:


(add-to-list 'load-path "~/.emacs.d/site-lisp/use-package")
(require 'use-package)

(with-eval-after-load 'info
  (info-initialize)
  (add-to-list 'Info-directory-list
               "~/.emacs.d/site-lisp/use-package/"))

(use-package try :ensure t) works only when I go next to (add-to-list ...) and press C-x C-e and then, next to (require-package 'use-package), and pressing C-x C-e. Only if do this use-package is activated. When I close Emacs and re-open it I have to press C-x C-e again, and so on. How I can use-package remain active, so to speak; or how can it get triggered everytime I open Emacs?

4
  • 1
    Are you sure that's the whole file? Commented Feb 4, 2021 at 9:08
  • Any reason not to use the code in the use-package readme? github.com/jwiegley/use-package#getting-started Commented Feb 4, 2021 at 12:25
  • Please provide a step-by-step recipe to reproduce the problem, starting with emacs -Q. It's not clear at all whether or why a (require 'use-package) at the top level of your init file would not try to load use-package. Commented Feb 4, 2021 at 16:10
  • Emacs will look for an init file in a specific sequence: it will use the first one it finds. So if you have a ~/.emacs e.,g., the ~/.emacs.d/init.el file is never going to be run. See How Emacs finds your init file Commented Oct 25, 2023 at 1:28

3 Answers 3

1

Like mentioned above your init.el file is probably not loaded properly.

Please keep in mind that emacs has an particular order in which it searches for the initial init files. https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html#Find-Init

~/.emacs.el > ~/.emacs > ~/.emacs.d/init.el

That also means if there is an ~/.emacs.el emacs will not search for ~/.emacs, or ~/.emacs.d/init.el anymore

If you wish your init file to be ~/.emacs.d/init.el please make sure that both of the other files don't exist.

1
  • I deleted .emacs and then reopened Emacs and it did not work. Commented Feb 4, 2021 at 23:17
0

It sounds like Emacs doesn't load your init.el file at startup.

Try to rename it as ~/.emacs.

2
  • yeah, this make sense. I renamed it but it still not loading the file when I open Emacs. Commented Feb 4, 2021 at 18:22
  • It does not automatically make sense. See Init file in the Emacs manual. Commented Mar 2, 2022 at 5:50
0

I got it to work by removing Emacs27 and installing Emacs26 and then rebooting ie reboot.

1

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.