For my require 'use-package
, I'm getting cannot load file
error but I really don't understand why.
In my ~/.emacs.d/init.el
file, at the very top, I have
(eval-when-compile
(require 'use-package))
(load (expand-file-name
"load-path" (file-name-directory load-file-name)) nil t)
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
(load-library "init-emacs00")
However, in my init-emacs00
file, at the very top, I too have
(eval-when-compile
(require 'use-package))
What strange is that my ~/.emacs.d/init.el
file doesn't have such error, while my init-emacs00.el
file does, as per flycheck
:
It seems my above adding "lisp"
into load-path
has done something bad, but I don't know elisp except copying from working code thus I don't know how to fix the problem, I just want to add ~/.emacs.d/lisp/
to my load-path
, where all my elisp resides, including my init-emacs00.el
file.
That means, although it seems my above adding "lisp"
is the problem, but they (all my elisp files) just load fine.
Also, I tried to add ~/.emacs.d/elpa/
to load-path
myself, where the use-package
is installed:
(eval-when-compile
(add-to-list 'load-path "~/.emacs.d/elpa/")
(require 'use-package))
but as we can see, that isn't working either.
UPDATE:
Thanks to db48x's help on how to find the current value of the variable, I found that,
user-emacs-directory
’s value is"~/.emacs.d/"
- and my
load-path
value already contains~/.emacs.d/elpa/
and~/.emacs.d/elpa/use-package-20210207.1926
, when I took the above screenshots.
which makes the above flycheck
warning very confusing.
user-emacs-directory
? Is there alisp
directory underneath that? Is the fileinit-emacs00
in there? BTW, it should probably be calledinit-emacs00.el
although that does not affect whether it will be found or not.C-h v
, then type the name of the variable (in this caseuser-emacs-variable
), and hit enter. It would also be useful to know the value ofload-path
after you got done with it.