Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perspective loses list of buffer when using bury/unbury-buffer #130

Closed
jivanmukti opened this issue Jun 3, 2020 · 1 comment
Closed

Comments

@jivanmukti
Copy link

Hi!

Perspective works perfectly, but when I scroll through buffers using bury-buffer and unbury-buffer, it scrolls through the global buffer list, and adds each buffer in the scroll to the current perspective. Is there any way to have bury/unbury-buffer scroll through the buffers in the current perspective only?

Thank you!

@gcv
Copy link
Collaborator

gcv commented Jun 10, 2020

It's not very easy to do. Emacs goes to considerable lengths to maintain the internal state which makes bury-buffer and the related machinery of next-buffer, previous-buffer, and last-buffer work correctly — none of which is Perspective-aware.

A naïve implementation could just advise bury-buffer and unbury-buffer to force them to cycle only through buffers in the current perspective. That can be made to work, but it would produce strange ordering behavior: the buffer bury order should remain the same for a given perspective (i.e., a stack) even after switching away from the perspective and back to it, and this is not guaranteed (or even likely).

A more robust approach is to implement Perspective-aware replacements for a whole bunch of these functions, which would rely on internal Perspective state and track the buffer list order. It will probably have to duplicate some of the logic in window.el to handle edge and corner cases with, e.g., window visibility. I'm not sure how much work this will involve. Patches welcome. 😀

The general problem came up before, #63. I will ask the same question as I did then: would the Perspective-aware buffer switchers be an adequate replacement for this functionality? persp-bs-show relies on Emacs built-in functionality and is quite lightweight. See the README for other implementations.

@gcv gcv closed this as completed Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants