reddit / emacs

How are you supposed to use use-package with straight.el?

Pay08 · 2022-12-23 22:17
I started undergoing the process of rewriting my existing config with use-package and straight.el, but I cannot get straight to install packages. Neither `:straight t`, nor `setq straight-use-package-by-default` works and Emacs complains about a bunch of missing definitions when compiling `init.el` (I know this is somewhat expected, but it happens with extremely simple to load packages, like company). I'm using GNU Emacs 28.2-r4, if that matters.
MitchellMarquez42 · 2022-12-23 22:30
Why are you compiling init.el? Pretty sure that discouraged. Definitely try (re)starting Emacs after enabling straight, and it should pull everything as it loads your use-package statements. There's also M-x straight-rebuild-all
Pay08 · 2022-12-23 22:45
`straight-rebuild-all` only builds 5 packages, namely use-package, vterm, which-key, flycheck and beacon.
nv-elisp · 2022-12-23 23:36
Share your init file. There's no way for us to help you without seeing the way you have it set up.
Pay08 · 2022-12-23 23:41
http://dpaste.com/H8KDH4Y2C
nv-elisp · 2022-12-23 23:53
I get Error: (void-function global-undo-tree-mode) Try restarting emacs with the `--debug-init` option. You likely have errors in your init file. It also looks like some of the syntax in your use-package declarations is off. For example: (use-package which-key :config ((which-key-setup-side-window-right)(which-key-mode))) Will throw the error: Error (use-package): which-key/:config: Invalid function: (which-key-setup-side-window-right) This is because you have an extra level of nesting for the :config body. It should be: (use-package which-key :config (which-key-setup-side-window-right) (which-key-mode)) Once you correct such errors, straight will properly build everything.
Pay08 · 2022-12-24 00:10
> (use-package which-key :config ((which-key-setup-side-window-right)(which-key-mode))) Huh, I thought you had to put all `:config` functions into a single list. Thanks. Undo-tree is probably not available in straight. Edit: thanks, that seems to have fixed it.
nv-elisp · 2022-12-24 01:00
Undo-tree is available, you just haven't installed it. The call to global-undo-tree-mode needs to be wrapped in a use-package declaration.
Pay08 · 2022-12-24 01:07
Oh right, now I remember! I thought undo-tree was built-in when I initially rewrote it all with use-package, so I just threw `global-undo-tree-mode` in there and forgot about it.
SaltyMycologist8 · 2022-12-25 05:14
;; bootstrap straight (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 6)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) ;; use use-package (straight-use-package 'use-package) ;; automatically ensure every package exists (like :ensure or :straight) (setq straight-use-package-by-default t)