1

I'm using emacs 29.1 on Windows. I have extracted the emacs folder to a corporate OneDrive. I have a home folder set up with emacs-29.1\share\emacs\site-lisp\site-start.el with (setenv "HOME" "C:\\path to my corp one drive \\HOME\\")

I store packages in (add-to-list 'load-path "~/.emacs.d/elpa/")

Unfortunately whenever I try to use use-package I get error Error (use-package): Cannot load xyz-package packages tested are org-drill and org-roam.

steps taken:

  • uninstalled and installed packages again.

  • tried launching runemacs.exe --debug-init (no additional info except the Error (use-package)

  • tried using (add-to-list 'load-path ('org-drill "~/.emacs.d/elpa/org-drill-20210427.2003/"))

(require 'org-drill)

  • instead when evaluating .emacs file error is: invalid function 'org-drill
Ian
  • 1,463
  • 11
  • 13
Marek
  • 13
  • 3

1 Answers1

0

Try first to set a correct $HOME environment variable - see this or this links.

Next, you need to add MELPA repository to your init.el file, since not all packages are available on the default emacs repository, as in below snippet:

(setq package-archives
      '(("gnu-elpa" . "https://elpa.gnu.org/packages/")
        ("nongnu" . "https://elpa.nongnu.org/nongnu/")
        ("melpa" . "https://melpa.org/packages/")))

;; Highest number gets priority (what is not mentioned has priority 0) (setq package-archive-priorities '(("gnu-elpa" . 3) ("melpa" . 2) ("nongnu" . 1)))

(package-initialize)

and then you must be sure the use-package is available and then you must load it, to become operative:

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
;; On Emacs version 29 ```use-package``` is built-in, so the previous
;; three lines can be avoided, an the next one is mandatory:
(require 'use-package)

Now you can ask for other packages(org-drill is available in MELPA):

(use-package org-drill
;; the rest of configuration
)
Ian
  • 1,463
  • 11
  • 13
  • Thank you very much!

    It did work. I kept the HOME setup from here It was enough to set package-archives and (package-initialize)

    – Marek Dec 11 '23 at 09:33