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

Local topspace-mode affects other buffers, too #5

Closed
DivineDominion opened this issue Mar 17, 2022 · 1 comment · Fixed by #6
Closed

Local topspace-mode affects other buffers, too #5

DivineDominion opened this issue Mar 17, 2022 · 1 comment · Fixed by #6
Labels
bug Something isn't working

Comments

@DivineDominion
Copy link

DivineDominion commented Mar 17, 2022

Describe the bug

M-x topspace-mode affects all buffers, not just the local one.

To Reproduce
Steps to reproduce the behavior:

Example:

  1. Open Emacs emacs -Q, install topspace
  2. Visit file1.el with (require 'topspace) in it.
  3. Open other window C-x 3, visiting another file there, file2.el (doesn't have to exist)
  4. Run M-x topspace-mode in one of the splits
  5. scroll both window splits with the mouse

Expected behavior
The window and its buffer where you ran topspace-mode scrolls down; the other doesn't

Actual behavior
Both windows can scroll down with topspace

Screenshots

Edit: I now realize this variable is not buffer-local by default anyway, and also t after the require, so that's irrelevant. Screenshots left here to show that the mode is off in one of the buffers.

The window where topspace-mode is run:
image

The window that shouldn't have been affected still has topspace-active set to t:
image

Emacs version

GNU Emacs 28.0.90 (build 1, aarch64-apple-darwin21.2.0, NS appkit-2113.20 Version 12.1 (Build 21C52))
of 2021-12-28

topspace.el from master

@trevorpogue trevorpogue added the bug Something isn't working label Mar 17, 2022
@trevorpogue
Copy link
Owner

Thanks for catching this. For anyone wondering, the issue was related to the fact that advice-add is used to surround scrolling functions with custom topspace functions, and advice-add naturally is a global operation so even if one buffer had topspace-mode enabled and added advice-add then all other buffers would still call the custom topspace functions even if topspace wasn't enabled in those buffers.

I added some flags in the advice-add functions to guard from this. Also, I clarified that topspace shouldn't be enabled when topspace-mode is nil, even if topspace-active is non-nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants