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/"))

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
    – matteol
    Nov 3, 2019 at 7:47
  • @matteol it is not an duplicate of the linked question
    – jue
    Nov 4, 2019 at 9: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 4, 2019 at 9: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) )
    – user25789
    Nov 4, 2019 at 10:41

1 Answer 1


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

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
    (require 'undo-tree)

Problem solved!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.