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

Drew
  • 75,699
  • 9
  • 109
  • 225
ccQpein
  • 123
  • 5

1 Answers1

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
Chris McMahan
  • 234
  • 1
  • 2