emacs-lsp / dap-mode

Emacs :heart: Debug Adapter Protocol
https://emacs-lsp.github.io/dap-mode
GNU General Public License v3.0
1.29k stars 181 forks source link

Using `exwm`, debugging a floating X window GUI program causes display failure. #402

Open WJCFerguson opened 3 years ago

WJCFerguson commented 3 years ago

exwm, the Emacs X Window Manager, will display a floating window in its own frame, so if the program you're debugging launches one, hits a breakpoint while that window has focus (typical), dap-mode creates its windows in that frame, rather than where I'd expect (presumably the launched-from frame?).

I can think of a hack - I'd just make an advice function around dap-debug that notes the launched-from frame, then another advice around dap-ui--show-buffer to use that frame (with-selected-frame, I think). But that's pretty grubby and not generic. I wonder how it should be done more correctly?

I assume few people hit this combination. If you have pointers though for how it should work, I might be able to generate a PR.

yyoncho commented 3 years ago

I think that your solution is in the right direction, the issue that we should fix is to make it a bit more convenient(e. g. no advice but hooks). I would propose introducing dap-debug-started-hook + making dap-ui--show-buffer configurable so you could set it to your function. Other than that I am not sure what options do we have.

nbfalcon commented 3 years ago

I propose something different - not showing many-windows in the stopped hook every time, but only once. I think I can implement this tomorrow.