bmag / emacs-purpose

Manage Windows and Buffers According to Purposes
GNU General Public License v3.0
498 stars 23 forks source link

Emacs 26 `xref` window management broke code1 #127

Closed wyuenho closed 6 years ago

wyuenho commented 6 years ago

screen capture

Steps to reproduce

  1. Install Emacs 26.1 (I've tested on the NS and the Mituharu Mac port)
  2. Call (purpose-x-code1-setup) in .emacs
  3. Visit an ELISP file that has a symbol that will pop up an xref buffer for selection after (xref-find-definitions) (I visited company.el)
  4. Adjust the edit window's width to something "small enough" (the screen cap edit window has a 93 (window-total-width)
  5. Move point to the symbol (I moved to company-backends)
  6. Press M-.
  7. The window showing the xref buffer is covered with an extra dired buffer
  8. Press q exits the dired buffer
  9. Press q again to exit the xref buffer
  10. Now we are back to the dired buffer we just quit and buried.
  11. Press q twice to exit the dired buffer
  12. Now there are 2 windows showing the file we visited.

Expected behavior

The extra dired window should never show up to begin with.

I've git-bisected this issue to be caused by this commit to Emacs 26, all subsequent commits shows the same behavior.

I'm not exactly sure what's going on here, does this have something to do with some weird interaction with #98 ?

P.S. I have pop-up-frames set to nil.

bmag commented 6 years ago

Couldn't reproduce it locally with, but did encounter some weirdness when using code1 while purpose-mode is disabled (which I think is to be expected).

Your repro steps don't mention if purpose-mode is enabled or not. Does this bug happen with or without purpsoe-mode?

wyuenho commented 6 years ago

I have purpose-mode enabled.

wyuenho commented 6 years ago

I was able to reproduce this with open -a emacs --args -Q and just window-purpose and company installed. I then M-x purpose-mode and followed up with M-x company-mode to warm up xref, and then tried M-. on one of the backend symbols on company-backends again.

bmag commented 6 years ago

I think I found the bug, will fix tomorrow or the day after.

bmag commented 6 years ago

Should be fixed by https://github.com/bmag/emacs-purpose/commit/a393b85d5a31f2a4a5fa5a720d412d910b4f5c59

wyuenho commented 6 years ago

This fix made things much worst. Now a dired buffer will pop open and take over the edit buffer whenever I visit a file. The post-command-hook that updates the dired buffer also put it onto the edit buffer after every command

bmag commented 6 years ago

Reverted for now.

wyuenho commented 6 years ago

Actually my mistake, the buffer does display at the correct window with this fix and the xref problem is gone, but hide-details mode did not take effect because that mode is buffer-local you have to wrap it in a with-current-buffer. I'll submit a fix now.

bmag commented 6 years ago

Ah, ok. Merged the fix, thanks.