0

I install yasnippet from the repository using the package manager and I add the corresponding directory to the load path before (use-package yasnippet):

    ;; Add all subdirs in site-lisp to the load-path
    (let ((default-directory "/usr/share/emacs/site-lisp/"))
      (normal-top-level-add-subdirs-to-load-path))

but when I start emacs it installs the package (despite of the load path) in the ".emacs.d/elpa/" directory. Is there a way to avoid it?

  • 2
    Possible duplicate of [Install packages globallly](https://emacs.stackexchange.com/questions/17558/install-packages-globallly) – matteol Nov 03 '19 at 07:47
  • @matteol it is not an duplicate of the linked question – jue Nov 04 '19 at 09:36
  • @Banish It should not do this, could you show your `use-package` sexp for yasnippet? When running emacs without your config `emacs -q`, is `yasnippet` available? (it should, because it is loaded by system wide emacs init scripts) – jue Nov 04 '19 at 09:39
  • @jue Do you mean init.el configuration for yasnippet: ;; Yasnippet ;; check documentation for all scripts for the corresponding language (use-package yasnippet :ensure t :init (yas-global-mode 1) ) –  Nov 04 '19 at 10:41

1 Answers1

0

When I execute the following lisp code:

(print load-path)

I get the list of all directories in the load path including /usr/share/emacs/site-lisp/ with all subdirectories. I've tried the following:

;; Undo Tree
;; using C-x u to choose and q to quit/undo/ to the step
(use-package undo-tree
  :ensure t
  :init
  (global-undo-tree-mode)
  )

and the package was automatically installed in "~/.emacs.d/elpa/". but when I've commented the ":ensure t" and delete the package from ".../elpa" but installed wit the package manager to "/usr/share/emacs/site-lisp/" I still had the undo-tree package but from the common directory.

(use-package undo-tree
  :init
  (progn
    (require 'undo-tree)
    (global-undo-tree-mode)
    ))

Problem solved!

  • Of course, this is what the `:ensure` keyword is for. Read at the [use-package documentation](https://github.com/jwiegley/use-package#package-installation) – jue Nov 04 '19 at 15:12