deb0ch / emacs-winum

Window numbers for Emacs - Navigate windows and frames using numbers
141 stars 13 forks source link

Window ordering wrong when using tab-bar-mode (in upcoming Emacs 27.1) #23

Open skangas opened 5 years ago

skangas commented 5 years ago

The upcoming Emacs 27.1 will feature both window and buffer tabs. I get unexpected results using winum-mode together with the new tab-bar-mode -- it gets the window ordering incorrect. It's not clear to me if this is due to a bug in winum-mode, tab-bar-mode or both.

Steps to reproduce:

  1. emacs -Q
  2. Evaluate (package-initialize)
  3. M-x tab-bar-mode
  4. M-x winum-mode
  5. Create some tabs and start mucking around.

I think you should pretty immediately begin to see misnumbered windows, windows out of order or numbered 3 or 4 even though there are only two visible windows.

I get relatively consistent results with, e.g. C-x 2 C-x o C-x 3, where the numbers are numbered 1, 2, 3 starting from the bottom right corner instead of from the top left.

It would be very nice if winum.el could get ready for Emacs 27.1, which is hopefully due to be released in the next few months. You could build the current master branch of Emacs to debug this, or just wait until (the pre-test of) Emacs 27.1 is released. Thanks in advance!

Best regards, Stefan Kangas

thomasheartman commented 3 years ago

@skangas I know it's been a while, but what did you do about this in the end?

I only started using tabs recently and ran into this (emacs 28). Advising the tab-bar-select-tab function solves the issue for me in most cases:

(defun heartman/update-winum (&rest args)
  (winum--update)
  args)

(advice-add 'tab-bar-select-tab :filter-return #'heartman/update-winum)

For whatever reason, it doesn't seem to work as expected when using tab-bar-switch-to-recent-tab. I know the heartman/update-winum function gets called, but winum doesn't seem to update. Any ideas or solutions to this would also be much appreciated.