Skip to content

Commit

Permalink
Allow the option of not overriding package-user-dir
Browse files Browse the repository at this point in the history
Currently prelude overrides user-package-dir to be <prelude-dir>/elpa

This patch does not change that behaviour, but gives the user
to disable it.

Adds a variable prelude-override-package-user-dir that by default is t.

The path is only set when prelude-override-package-user-dir is true
  • Loading branch information
gitmsr committed Aug 12, 2023
1 parent b57ff48 commit e4c38dc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Add a F# module.
* Auto-install `use-package`.
* Add `prelude-vertico` module. Vertico a simpler alternative to `ivy-mode` and supersedes Selectrum.
* Add `prelude-override-package-user-dir` to avoid overriding package-user-dir.

### Changes

Expand Down
8 changes: 6 additions & 2 deletions core/prelude-packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@
(if (file-exists-p prelude-pinned-packages-file)
(load prelude-pinned-packages-file)))

;; set package-user-dir to be relative to Prelude install path
(setq package-user-dir (expand-file-name "elpa" prelude-dir))

(when prelude-override-package-user-dir
;; set package-user-dir to be relative to Prelude install path
(setq package-user-dir (expand-file-name "elpa" prelude-dir))
)

(package-initialize)

;; install & enable use-package
Expand Down
9 changes: 9 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,12 @@ desktop environments might be making heavy use of such keybindings. (in most cas
Some of these settings (those that don't need to be pre-loaded) can also be set
on a per-file or directory basis by using a file local variable or a
`.dir-locals.el` file.

### package-user-dir

By default, prelude sets the directory where downloaded modules are installed to `<prelude-dir>/elpa`. If you want
to disable this behaviour, set the following variable to nil before loading prelude.

```emacs-lisp
(setq prelude-override-package-user-dir nil)
```
3 changes: 3 additions & 0 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ by Prelude.")
"This folder stores all the automatically generated save/history-files.")
(defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-personal-dir)
"This file contains a list of modules that will be loaded by Prelude.")
(devar prelude-override-package-user-dir t
"By default prelude installs downloaded packages in <prelude-dir>/elpa.
Set to nil to override this behaviour")

(unless (file-exists-p prelude-savefile-dir)
(make-directory prelude-savefile-dir))
Expand Down

0 comments on commit e4c38dc

Please sign in to comment.