0

I just install use-package yesterday and still learning it. I notice use-package is not working in my environment:

Here is my init file:

(require 'package)
(dolist (url '(("melpa" . "https://melpa.org/packages/")
               ("melpa-stable" . "http://stable.melpa.org/packages/")))
  (add-to-list 'package-archives url t))
(dolist (path '("~/.emacs.d/elpa" "~/.emacs.d/plugins/" "~/.emacs.d/lisp/"))
  (add-to-list 'load-path path))
(setq package-enable-at-startup nil)
(package-initialize)
(eval-when-compile (require 'use-package))
(require 'init-treemacs)

Here is my init-treemacs file in .emacs.d/lisp/

(use-package treemacs-mode
  :ensure t
  :init (bind-key "C-x M-d" treemacs)
  :custom (treemacs-width 25))
(provide 'init-treemacs)

When I start Emacs, treemacs looks like not be loaded.

  1. C-x M-d does not work
  2. I start treemacs manually, and treemacs-width is not 25

Do I miss something? I have reinstalled use-package, compiled every file again, added & removed ensure. Nothing changed.

Emacs 26.1 installed by brewcask, use-package 2.4

1

treemacs-mode is not the name of the the package. It's just 'treemacs'

try

(use-package treemacs
 :ensure t
 :bind (("C-x M-d" . treemacs))
 :custom (treemacs-width 25)
 :config
  (provide 'init-treemacs))

I don't know if the provide statement needs to be within the config block, but this worked for me in testing.

  • Chris
  • I am sorry about last commend Chris, it actually works, my mistake. Thanks for your help. – ccQpein Sep 13 '18 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.