Doom-emacs: [QUESTION] Why does +ivy/switch-workspace-buffer not show EXWM buffers?

Created on 19 Sep 2019  路  7Comments  路  Source: hlissner/doom-emacs

I'm using EXWM and when I invoke +ivy/switch-workspace-buffer, buffers of X windows are excluded. +ivy/switch-buffer still shows them. Should I pose this question to the EXWM maintainer or is this a missconfiguration of doom?

question resolved

Most helpful comment

I've never used EXWM, so I can only guess that EXWM buffers are named like temporary buffers, i.e. with a leading space or asterix, e.g. *EXWM buffer*. As far as Doom is concerned, these are not "real" buffers, and SPC b b (+ivy/switch-workspace-buffer) only lists real buffers associated with the current workspace.

To get Doom to recognize these buffers, the easiest way is to add doom-mark-buffer-as-real-h to the hook of whatever major mode exwm uses for its buffers. Again, not an exwm user, so assuming something like exwm-buffer-mode exists, then this would work:

(add-hook 'exwm-buffer-mode-hook #'doom-mark-buffer-as-real-h)

For detalis on how Doom determines if a buffer is "real", see SPC h f doom-real-buffer-p (or C-h f doom-real-buffer-p if you aren't an evil user).

All 7 comments

I've never used EXWM, so I can only guess that EXWM buffers are named like temporary buffers, i.e. with a leading space or asterix, e.g. *EXWM buffer*. As far as Doom is concerned, these are not "real" buffers, and SPC b b (+ivy/switch-workspace-buffer) only lists real buffers associated with the current workspace.

To get Doom to recognize these buffers, the easiest way is to add doom-mark-buffer-as-real-h to the hook of whatever major mode exwm uses for its buffers. Again, not an exwm user, so assuming something like exwm-buffer-mode exists, then this would work:

(add-hook 'exwm-buffer-mode-hook #'doom-mark-buffer-as-real-h)

For detalis on how Doom determines if a buffer is "real", see SPC h f doom-real-buffer-p (or C-h f doom-real-buffer-p if you aren't an evil user).

That worked for me, thanks.

a first class citizen in Doom ...

It doesn't seem like that does the trick for me. None of the X windows start with *.

Here is a screenshot from regular ivy-switch-buffer which displays X windows (e.g. Firefox, or the gnome-control-center).
rsz_screenshot_from_2019-11-21_23-13-24

@WhatDothLife can you confirm that @hlissner's solution is still working for you?

I have also found this reddit post with a proposed solution, which didn't work for me their. Hopefully this will help me to find a solution.

In the meantime I have remapped SPC b b and SPC . to ivy-switch-buffer.

One last thing, it looks like SPC backtick is also affected by this.

@alaq Try the following:

;; add to ~/.doom.d/config.el
(after! persp-mode
  (remove-hook 'persp-add-buffer-on-after-change-major-mode-filter-functions
               #'doom-unreal-buffer-p))

@hlissner that did it! Thank you so much! :tada:

@alaq This may have some nasty side-effects though. e.g. it may break session persistence in some rare cases when persp-mode tries to serialize special unreal buffers (which was the reason I added that filter function in the first place). Perhaps this is a better solution:

(add-hook 'exwm-mode-hook #'doom-mark-buffer-as-real-h)

It's perfect, I tried your most recent solution.
Much appreciated!

Was this page helpful?
0 / 5 - 0 ratings