When I do treemacs/toggle, I get the above error.
Here is the trace (I redacted the file and project name):
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
treemacs-find-file-node("/path/to/file.py" #s(treemacs-project :name "project" :path "/path/to" :path-status local-readable))
treemacs--follow()
treemacs--init()
(progn (fset (quote treemacs-workspace->is-empty\?) vnew) (treemacs--init))
(unwind-protect (progn (fset (quote treemacs-workspace->is-empty\?) vnew) (treemacs--init)) (fset (quote treemacs-workspace->is-empty\?) old))
(let* ((vnew (symbol-function (quote ignore))) (old (symbol-function (quote treemacs-workspace->is-empty\?)))) (unwind-protect (progn (fset (quote treemacs-workspace->is-empty\?) vnew) (treemacs--init)) (fset (quote treemacs-workspace->is-empty\?) old)))
(let ((origin-buffer (current-buffer))) (let* ((vnew (symbol-function (quote ignore))) (old (symbol-function (quote treemacs-workspace->is-empty\?)))) (unwind-protect (progn (fset (quote treemacs-workspace->is-empty\?) vnew) (treemacs--init)) (fset (quote treemacs-workspace->is-empty\?) old))) (let ((--dolist-tail-- (let* ((self (or treemacs-override-workspace ...))) (aref self 2)))) (while --dolist-tail-- (let ((project (car --dolist-tail--))) (treemacs-do-remove-project-from-workspace project) (setq --dolist-tail-- (cdr --dolist-tail--))))) (save-current-buffer (set-buffer origin-buffer) (let ((project-root (or (doom-project-root) default-directory))) (treemacs-do-add-project-to-workspace (let (file-name-handler-alist) (let* ((path ...)) (if (and ... ...) (substring path 0 -1) path))) (doom-project-name project-root))) (setq treemacs--ready-to-follow t) (if (or treemacs-follow-after-init treemacs-follow-mode) (progn (treemacs--follow)))))
+treemacs--init()
(if (eq val (quote visible)) (progn (delete-window (treemacs-get-local-window))) (+treemacs--init))
(let* ((val (cond ((treemacs-get-local-window) (quote visible)) ((treemacs-get-local-buffer) (quote exists)) (t (quote none))))) (if (eq val (quote visible)) (progn (delete-window (treemacs-get-local-window))) (+treemacs--init)))
+treemacs/toggle()
funcall-interactively(+treemacs/toggle)
call-interactively(+treemacs/toggle nil nil)
command-execute(+treemacs/toggle)
That's a doom wrapper you're using. Try using treemacs-select-window after a restart.
Thanks for the fast response.
That's correct -- I'm using doom. I did a restart and used treemacs-select-window, but I got the same error.
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
treemacs-find-file-node("/path/to/filepy" #s(treemacs-project :name "project" :path "/path/to" :path-status local-readable))
treemacs--follow()
#f(compiled-function () (interactive nil) #<bytecode 0x450ac985>)()
apply(#f(compiled-function () (interactive nil) #<bytecode 0x450ac985>) nil)
treemacs-select-window()
funcall-interactively(treemacs-select-window)
call-interactively(treemacs-select-window record nil)
command-execute(treemacs-select-window record)
counsel-M-x-action("treemacs-select-window")
#f(compiled-function (x) #<bytecode 0x459455b1>)("treemacs-select-window")
ivy-call()
#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>)("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
apply(#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>) ("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
#f(advice-wrapper :filter-args #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>) ivy-prescient--enable-sort-commands)("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
apply(#f(advice-wrapper :filter-args #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>) ivy-prescient--enable-sort-commands) ("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x))
ivy-posframe--read(#f(advice-wrapper :filter-args #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>) ivy-prescient--enable-sort-commands) "M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
apply(ivy-posframe--read #f(advice-wrapper :filter-args #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially. An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero. Otherwise, use the first occurrence of\nPRESELECT in the collection. Comparison is first done with\n`equal'. If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input. It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS can be used to store collection-specific\nsession-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x45f265d1>) ivy-prescient--enable-sort-commands) ("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x))
ivy-read("M-x " ("treemacs-select-window" "toggle-debug-on-error" "lsp-treemacs-call-hierarchy" "lsp-treemacs-sync-mode" "ispell-word" "dap-hydra" "getenv" "lsp-format-buffer" "lsp-metals-build-import" "lsp-find-type-definition" "haskell-session-change" "run-python" "pyvenv-activate" "lsp-restart-workspace" "sql-mysql" "+haskell/open-repl" "setenv" "json-reformat-region" "lsp-ui-sideline-mode" "projectile-discover-projects-in-directory" "lsp-metals-build-connect" "haskell-mode-stylish-buffer" "lsp-ui-imenu" "ein:notebooklist-new-notebook" "ein:run" "helm-imenu" "+format/buffer" "package-install" "lsp-metals-doctor-run" "lsp-shutdown-workspace" "lsp-ui-sideline-toggle-symbols-info" "eshell" "version" "describe-function" "ein:notebook-open" "+python/open-ipython-repl" "org-backward-heading-same-level" "xref-find-definitions-other-frame" "+default/lsp-format-region-or-buffer" "nyan-mode" "sbt-start" "yas-expand" "company-lsp" "dash-at-point" "org-table-create" "org-toggle-checkbox" "lsp-organize-imports" "lsp-workspace-restart" "ein:connect-to-notebook" "lsp-ui-peek-find-references" ...) :predicate #f(compiled-function (x) #<bytecode 0x45f65015>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)
Does (treemacs-current-workspace) output a workspace that has a project for that file?
Does turing off treemacs-follow-mode and manually calling treemacs-find-file work?
And of course make sure your treemacs is up-to-date. (I believe doom handles that on its own so its doom you will have to update)
Doom and treemacs are up-to-date. I updated a couple of hours ago. (treemacs-current-workspace) outputs the correct workspace:
#s(treemacs-workspace "Default Workspace"
(#s(treemacs-project "project" "/path/to" local-readable)))
Manually calling treemacs-find-file does work indeed. There was actually no need for turning off treemacs-follow-mode.
The subsequent toggle/treemacs and treemacs-select-window also work after calling the treemacs-find-file once.
Can you edebug into treemacs-find-file-node and tell me exactly in which line the error happens?
If not here is some debug code that you need to load that will trace what is happening. That requires knowing exactly what path it was called with, so you will either need to stop hiding what you are working on or find another example.
(defun treemacs-find-file-node (path &optional project)
(unless project (setq project (treemacs--find-project-for-path path)))
(treemacs-log "Input %s %s" path project)
(treemacs-log "Start Pos %s" (treemacs-project->position project))
(treemacs-log "Path Minus Root %s" (->> project (treemacs-project->path) (length) (substring path)))
(treemacs-log "Dir Parts %s" (nreverse (s-split (f-path-separator) (->> project (treemacs-project->path) (length) (substring path)) :omit-nulls)))
(let* (;; go back here if the search fails
(start (prog1 (point) (goto-char (treemacs-project->position project))))
;; the path we're moving to minus the project root
(path-minus-root (->> project (treemacs-project->path) (length) (substring path)))
;; the parts of the path that we can try to go to until we arrive at the project root
(dir-parts (nreverse (s-split (f-path-separator) path-minus-root :omit-nulls)))
;; the path we try to quickly move to because it's already open and thus in the dom
(goto-path path)
;; manual as in to be expanded manually after we moved to the next closest node we can find
;; in the dom
(manual-parts nil)
(dom-node nil))
;; try to move as close as possible to the followed file, starting with its immediate parent
;; keep moving upwards in the path we move to until reaching the root of the project (counter = 0)
;; all the while collecting the parts of the path that beed manual expanding
(-let [continue t]
(while continue
(treemacs-log "Dir Parts Iteration")
(setf dom-node (treemacs-find-in-dom goto-path)
goto-path (treemacs--parent goto-path))
(treemacs-log "Dom Node Key %s Pos %s"
(treemacs-dom-node->key dom-node)
(treemacs-dom-node->position dom-node))
(treemacs-log "Goto Path %s" goto-path)
(if (or (null dom-node)
;; dom node might exist, but a leaf's position is not always known
(null (treemacs-dom-node->position dom-node)))
(progn
(push (pop dir-parts) manual-parts)
(treemacs-log "No Dom Node Or Pos, Set Manual Parts To %s" manual-parts)
(treemacs-log "Dir Parts Left %s" dir-parts))
(setf continue nil)
(treemacs-log "Found Pos, Loop Cancelled"))))
(let* ((btn (--if-let (treemacs-dom-node->position dom-node)
it
(treemacs-project->position project)))
;; do the rest manually - at least the actual file to move to is still left in manual-parts
(progn
(treemacs-log "Manual Rest With Parts %s Pos %s" manual-parts btn)
(search-result (if manual-parts (save-match-data
(treemacs--follow-each-dir btn manual-parts project))
(goto-char btn)))))
(if (eq 'follow-failed search-result)
(prog1 nil
(goto-char start))
(treemacs-log "Result %s" search-result)
(treemacs-dom-node->set-position! (treemacs-find-in-dom path) search-result)
search-result))))
I've started experiencing similar issues lately as well. I believe it might be related but I'm not sure. Please let me know if I should open a separate issue.
I'm running
27.0.90Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p #<overlay from 76 to 87 in *Treemacs-Scoped-Buffer-#<frame emacs27@titan 0x565555adf000>*>)
treemacs--expand-dir-node(#<marker (moves after insertion) at 80 in *Treemacs-Scoped-Buffer-#<frame emacs27@titan 0x565555adf000>*> :git-future #<process Process Future>)
treemacs-find-file-node("/scratch/git/gophercloud/acceptance/openstack/compute/v2/compute.go" #s(treemacs-project :name "gophercloud" :path "/scratch/git/gophercloud" :path-status local-readable))
treemacs--follow()
apply(treemacs--follow nil)
timer-event-handler([t 0 0 200000 nil treemacs--follow nil idle 0])
Please let me know if there are better ways I can help debug this!
Not sure if it's related but about the same time as these problems started appearing, I've started seeing "face issues". I'll attach an image showing some of the odd artifacts being rendered in treemacs.

Please disregard from my two comments. My issues appear to be related to combined use with lsp-ui. I'm not 100% sure about the exact circumstances in which the problem occurs, but for some reason it appears to be working well when I enable lsp-mode (and as a consequencelsp-ui) calling the lsp-deferred function rather than lsp. In any case my problems were not necessarily a problem in treemacs, but rather in using it combined with lsp-ui I believe. I'll see if I can reproduce the issue in more detail and only then file an issue against the right project.
lsp-ui does use treemacs as a render backend so please ping me when you find something.
Closing on account of inactivity.
@petergardfjall same issue and odd artifacts being rendered in treemacs too. Did you resolve it?
@opsnull I still see similar errors occasionally. It _seems_ to happen when I open up treemacs too quickly after initializing lsp, although I cannot say for sure.
@petergardfjall after disable lsp-enable-links, the error gone, treemacs works normaly.
@opsnull Nice find, thanks!
after disable lsp-enable-links, the error gone, treemacs works normaly.
That sounds like a race condition or an incorrect implementation with those links getting highlighted in the wrong buffer. You should report this upstream.
FYI @yyoncho
Most helpful comment
@petergardfjall after disable lsp-enable-links, the error gone, treemacs works normaly.