Window numbering duplicated with duplicate buffers
Closed this issue · 3 comments
When two windows on the current frame are displaying the same buffer,
each window displays the same overlay number.
To re-create:
-
C-x 1
-
C-x b scratch
-
C-x 3
-
C-x o
-
M-x list-buffers
-
C-x 2
-
M-x pop-to-buffer scratch
-
M-x bupper-switch
This bug would be solved by using the approach taken by package swap-buffers. I saw your response to Chris Rayner that you want the buffer contents to remain visible. You can do that and solve this bug by using their techniue but also copying the visible contents of each visible buffer into its temporary replacement.
I'm thinking now that this project should be combined with that other one, if both parties are interested. Once you solve this bug report, it seems that the only default major difference between the two packages from the end-user's perspective is that one displays the buffer content and the other doesn't. Combining the projects would also bring the advantage that the other package has more advanced labeling options because it's based upon package switch-window. From a content perspective, your code is simpler and smaller and doesn't need the extra dependency, so that's a plus for keeping it a separate package.
You can do that and solve this bug by using their techniue but also copying the visible contents of each visible buffer into its temporary replacement.
That was exactly what I was thinking, and I was exploring the idea of using indirect buffers. For closing #10, in order to ensure enough space for the overlays, what I did is to exactly copy and restore the whole buffer content. The reason is that in the case of a buffer with the first rows in the window that does not have enough space for the overlay, I insert the required amount of spaces.
This approach though won't fix the duplicated numbering, that's why I was thinking of using indirect buffers:
- for each window I get the corresponding buffer,
- clone an indirect buffer from the original one (so if the same buffer is visited from
N
windows, there will also beN
indirect buffers), - at this point there's a 1:1 relationship between a window and an indirect buffer, hence numbering is fine,
- I add the overlays,
- prompt the selection,
- swap the indirect buffers,
- replace indirect buffers with the original ones,
- delete all indirect buffers.
I'm thinking now that this project should be combined with that other one, if both parties are interested. Once you solve this bug report, it seems that the only default major difference between the two packages from the end-user's perspective is that one displays the buffer content and the other doesn't. Combining the projects would also bring the advantage that the other package has more advanced labeling options because it's based upon package switch-window. From a content perspective, your code is simpler and smaller and doesn't need the extra dependency, so that's a plus for keeping it a separate package.
Thanks a lot @Boruch-Baum for your interest, but at this point, I'm not interested in combining the two packages. The main reason is that I'm currently learning elisp and this package is a great playground. The effort of combining the two packages would make the development move slower compared to working as a solo-developer. For sure it's something that I'd gladly evaluate in the future.
@Boruch-Baum it would be great if you could give it another try! 🙏