I have just upgraded Treemacs on my GNU Emacs 27.2, from an ELPA version from 2 years ago to 20210516. But now when I try M-x treemacs, I get the following error:

Wrong type argument: treemacs-workspace, nil

I get the same if I M-x load-library <RET> treemacs <RET>, then M-: (treemacs--init) <RET>. But if I do the following, then it works:

  • M-x load-library <RET> treemacs <RET>
  • M-x find-function <RET> treemacs--init <RET>, go right after it and C-x C-e
  • M-: (treemacs--init) <RET>

So re-evaluating the treemacs--init function from the source file, before invoking it, seems OK. Any idea why, and how to solve it?

I upgraded the package by M-x list-packages <RET>, then i on the new version and d on the old, already installed version of Treemacs.

The complete stacktrace I got if I invoke M-x toggle-debug-on-error first:

Debugger entered--Lisp error: (wrong-type-argument treemacs-workspace nil)
  signal(wrong-type-argument (treemacs-workspace nil))
  (save-current-buffer (set-buffer origin-buffer) (treemacs--follow))
  (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow)))
  (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow))))
  (let ((origin-buffer (current-buffer)) (current-workspace (treemacs-current-workspace)) (run-hook\? nil) (visibility (cond ((treemacs-get-local-window) 'visible) ((treemacs-get-local-buffer) 'exists) (t 'none)))) (cond ((eq visibility 'visible) (treemacs--select-visible-window)) ((eq visibility 'exists) (let ((buffer (current-buffer))) (treemacs--setup-buffer) (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer buffer) (treemacs--follow)))) (run-hook-with-args 'treemacs-select-functions 'exists))) ((eq visibility 'none) (treemacs--setup-buffer) (treemacs-mode) (treemacs--render-projects (progn (progn (aref current-workspace 2)))) (if (null (let ((cl-x ...)) (progn (progn ...)))) (progn (let* ((path ...) (name ...)) (treemacs-do-add-project-to-workspace path name) (progn (if ... nil ...) (setq treemacs-eldoc-display nil) (if treemacs--no-messages nil ...) (add-hook ... ...))))) (goto-char 2) (setq run-hook\? t)) (t nil)) (if root (progn (treemacs-do-add-project-to-workspace (let (file-name-handler-alist) (let* ((path ...)) (if (and ... ...) (substring path 0 -1) path))) name))) (with-no-warnings (setq treemacs--ready-to-follow t)) (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow)))) (if run-hook\? (progn (run-hook-with-args 'treemacs-select-functions visibility))))
  eval((treemacs--init) t)
  eval-expression((treemacs--init) nil nil 127)
  funcall-interactively(eval-expression (treemacs--init) nil nil 127)
  call-interactively(eval-expression nil nil)
  • Have you restarted emacs since upgrading treemacs? May 16 at 15:04
  • You might want to contact the maintainers of Treemacs, if you don't get a helpful answer here.
    – Drew
    May 16 at 15:11
  • @FranBurstall Yes I did, more than once :-) May 16 at 21:08
  • @Drew Yes, it is maybe more a matter for opening a ticket there... May 16 at 21:09

Your Answer

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

Browse other questions tagged or ask your own question.