0

I use treemacs for project management. For some reason (even if I don't have treemacs buffer opened) when I try to launch Dired for the first time I get

invalid function: treemacs-block

What is even more stranger, if try again to launch Dired again, it works, and I don't see the message.

Debug Message

Debugger entered--Lisp error: (invalid-function treemacs-block)
  treemacs-block(nil)
  treemacs-icons-dired--display-icons-for-subdir("c:/Users/opimenov/AppData/Roaming/.emacs.d/" #<marker at 1 in .emacs.d>)
  treemacs-icons-dired--display()
  run-hooks(dired-after-readin-hook)
  #f(compiled-function (&optional arg noconfirm) "Reread the Dired buffer.\nMust also be called after `dired-actual-switches' have changed.\nShould not fail even on completely garbaged buffers.\nPreserves old cursor, marks/flags, hidden-p.\n\nDired sets `revert-buffer-function' to this function.  The args\nARG and NOCONFIRM, passed from `revert-buffer', are ignored." #<bytecode 0x2c7517d>)(nil nil)
  apply(#f(compiled-function (&optional arg noconfirm) "Reread the Dired buffer.\nMust also be called after `dired-actual-switches' have changed.\nShould not fail even on completely garbaged buffers.\nPreserves old cursor, marks/flags, hidden-p.\n\nDired sets `revert-buffer-function' to this function.  The args\nARG and NOCONFIRM, passed from `revert-buffer', are ignored." #<bytecode 0x2c7517d>) (nil nil))
  dired-revert(nil nil)
  revert-buffer()
  dired-sort-toggle()
  dired-sort-toggle-or-edit()
  (lambda nil (dired-hide-details-mode) (dired-sort-toggle-or-edit))()
  run-hooks(change-major-mode-after-body-hook dired-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook dired-mode-hook))
  run-mode-hooks(dired-mode-hook)
  dired-mode("c:/Users/opimenov/AppData/Roaming/.emacs.d/" "-al")
  dired-internal-noselect("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  dired-noselect("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>)("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  ls-lisp--dired(#f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>) "c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  apply(ls-lisp--dired #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>) ("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil))
  #f(advice-wrapper :around #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>) ls-lisp--dired)("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  ad-Advice-dired(#f(advice-wrapper :around #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>) ls-lisp--dired) "c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  apply(ad-Advice-dired #f(advice-wrapper :around #f(compiled-function (dirname &optional switches) "\"Edit\" directory DIRNAME--delete, rename, print, etc. some files in it.\nOptional second argument SWITCHES specifies the `ls' options used.\n(Interactively, use a prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards appended to select certain files).\n\nIf DIRNAME is a cons, its first element is taken as the directory name\nand the rest as an explicit list of files to make directory entries for.\nIn this case, SWITCHES are applied to each of the files separately, and\ntherefore switches that control the order of the files in the produced\nlisting have no effect.\n\n\\<dired-mode-map>You can flag files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "")) #<bytecode 0x2c74de9>) ls-lisp--dired) ("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil))
  dired("c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  funcall-interactively(dired "c:/Users/opimenov/AppData/Roaming/.emacs.d/" nil)
  call-interactively(dired nil nil)
  command-execute(dired)

Found this issue on maintainer's page. Basically states that treemacs and treemacs-icons-dired need to be updated in sync. Which I did without any further progress. issue

  • Set debug-on-error to nil, to see what is trying to invoke treemacs-block. Sounds like you need to load the library that defines that function before you let that caller invoke it. – Drew Mar 1 at 1:34
  • @Drew I do have it set to nil. – A_P Mar 1 at 14:14
  • Sorry, I meant t, not nil. Dunno why I wrote that. – Drew Mar 1 at 15:34
  • Looks like treemacs-icons-dired is not happy – A_P Mar 1 at 15:56
  • 1
    It sounds like you found the answer. Please consider posting that as an answer (not as part of the question). That way the question will not be listed as unanswered. (You can accept your own answer.) – Drew Mar 1 at 17:09
0

If you are in the future (past Feb 2019) you may not run into this problem. But if you do the solution is to uninstall/delete treemacs and treemacs-icons-dired packages and reinstall them. It solves the problem of (invalid-function treemacs-block). After reinstall you most likely will see a multitude of cryptic errors and nothing will work. The problem is that newer versions require Python 3 set as executable python. To do so: C-h v treemacs-python-executable ENT then go to customization and set the path to your python3 executable. Hope this helps.

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.