This is my Emacs configuration
and I’m now getting this the error in subject when I try to create a new node.
Weirdly after I removed my whole
.emacs.d and recreated it it was fixed, but today it’s broken again without really having done any changes.
Any idea what it could be?
I suspect it’s maybe related to treemacs, but changing the config there didn’t help yet, so maybe it’s something else.
Actually I could narrow it down, the problem is this function
(defun treemacs-enable-and-show ()
(message "inside treemacs-enable-and-show")
(when (equal 'none (treemacs-current-visibility))
(with-current-buffer (find-buffer-visiting buffer-file-name)
Which is used a find-file-hook:
(add-hook 'find-file-hook 'treemacs-enable-and-show)
Not sure how to fix it though, org-capture is doing something weird apparently there when creating the buffer?
February 21, 2023, 11:59am
(remove-hook 'find-file-hook 'treemacs-enable-and-show)
February 21, 2023, 12:04pm
Also try toggle-debug-on-error and see the backtrace. it should show a call stack, which helps you determine offending function and context.
Yeah sure I removed the hook, but I would like to enable it again once I fix it, since it’s quite useful.
Anyway this is the full error, and the file is actually created, and if I try to visit it a second time it works, I just can’t see see the right buffer when I do
C-c n f for the first time.
error("Capture template `%s': %s" "d" "Cannot make side window the only window")
org-roam-capture-(:node #s(org-roam-node :file nil :file-title nil :file-hash nil :file-atime nil :file-mtime nil :id "2ed85b66-dc6f-4d5e-9f7a-4946f2dbe18f" :level nil :point nil :todo nil :priority nil :scheduled nil :deadline nil :title "check check again" :properties nil :olp nil :tags nil :aliases nil :refs nil) :templates nil :props (:finalize find-file :call-location #<marker at 1 in 20230221110739-check_somethinig.org>))
#<subr command-execute>(org-roam-node-find nil nil nil)
ad-Advice-command-execute(#<subr command-execute> org-roam-node-find)
apply(ad-Advice-command-execute #<subr command-execute> org-roam-node-find)
February 22, 2023, 5:47pm
What seems to be happening is as follows:
You star org-capture via org-roam-node-find
Emacs opens a capture buffer
At the same time, Emacs opens a treemacs buffer as a side-buffer via find-file-hook
You complete the capture peocess
Emacs tries to close the capture buffer
Emacs errors because side-buffer cannot be threonly buffer in a frame
If this is indeed what is happening then, you can just have a conditional in your the function set in find-file-hook to avoid opening treemacs for the capture buffer.
February 22, 2023, 5:55pm
To test the idea, it should be trivial to modify the initial conditional in this function and check if the buffer-name contains “CAPTURE”.