emacs-purpose
emacs-purpose copied to clipboard
window-purpose interfering with org-roam buffer display
org-roam defines org-roam-buffer-toggle command which is supposed to pop up *org-roam* buffer on the right using about one third the width of the window via this setup:
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-direction)
(direction . right)
(window-width . 0.33)
(window-height . fit-window-to-buffer)))
However a narrow window at bottom is created. This is due to display-buffer-overriding-action being set to (purpose--action-function) rather than nil via this code in purpose-mode.
A workaround is to temporarily set the variable to nil, i.e., this advice:
(defadvice org-roam-buffer-toggle (around disable-window-purpose activate compile)
"Disable setup done by window-purpose layer to prevent it from interfering."
(let ((display-buffer-overriding-action nil))
ad-do-it))
With this advice *org-roam* buffer is properly displayed on the right.
Is it possible to resolve the problem without setting display-buffer-overriding-action to nil which probably could be done also by disabling purpose-mode. Should we just accept the fact that org-roam and purpose-mode are not compatible?
I submitted spacemacs PR #15302 to report this problem.
You should use purpose-action-function-ignore-buffer-names. You can see an example in window-purpose-fixes.el#L159:
(add-to-list 'purpose-action-function-ignore-buffer-names "^ \\*LV\\*$")
Please tell me if this solves the problem:
(add-to-list 'purpose-action-function-ignore-buffer-names "\\*org-roam\\*")
Yes this works. However this does not sit well with me. Each time some other package sets up display-buffer-alist and it does not work, I have to once again update this alist to exclude the buffer?
I am going to simply disable window-purpose completely from spacemacs and see what the difference is.
I read the documentation again, but I don't understand what the benefit is of limiting what buffers a window can display. In fact I have been very perplexed for a while why I cannot switch to some buffers when I'm looking at Help buffer. Perhaps this is due to this purpose-mode thing. If that is the case, then I don't want it!