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

auto-highlight-symbol-related functionality broken in Spacemacs #7

Open
alexalekseyenko opened this issue Jul 2, 2021 · 7 comments

Comments

@alexalekseyenko
Copy link

Is there a recommended way to disable the new highlighting functionality? This may seem like a strange request given the name/nature of this project, but it seems that I'm not the only one wondering:
syl20bnr/spacemacs#14880

Excluding the entire package isn't a great solution since Spacemacs relies on this package for some of its functionality:
https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bspacemacs/spacemacs-navigation/funcs.el#L91

@jcs090218
Copy link
Member

jcs090218 commented Jul 2, 2021

Would this commit be the cause d9b83fa?

The previous author has a typo in the face defalt -> default.

Other way to temporary disable highlighting is these variables. Other than these you would have to set (auto-highlight-symbol-mode -1).

  • ahs-disabled-commands
  • ahs-disabled-minor-modes
  • ahs-disabled-flags

@alexalekseyenko
Copy link
Author

alexalekseyenko commented Jul 2, 2021

So it looks like we were leaning pretty heavily on how ahs-idle-timer was being used:
https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bspacemacs/spacemacs-navigation/packages.el#L73-L82
I'm not sure how you were supposed to know that, but for what it's worth, the recent changes are currently breaking the auto-highlight-symbol-related functionality for everyone using Spacemacs (or at least the develop branch, which I think is basically everyone using Spacemacs).

Is this something you would be interested in exploring with us? We can make the changes here, or try to change Spacemacs to fit the new logic, or some combination of both, but I figure if we want to preserve the existing integration between these projects, we should probably make that decision explicitly.

In other news, it looks like you are now using run-with-timer instead of run-with-idle-timer:
51a54a7#diff-e7a9435d360fadbeb259c0d4db30503bbaf19ae209f140595f61ac60279d9ba6
I might be missing something, but isn't that likely to degrade performance? If Emacs is idle, it should be pretty safe to spend some cycles identifying and highlighting matches, but if that's running while we're doing other computationally intensive things, it seems like that could cause stuttering.

@alexalekseyenko alexalekseyenko changed the title How to disable highlighting auto-highlight-symbol-related functionality broken in Spacemacs Jul 2, 2021
@jcs090218
Copy link
Member

jcs090218 commented Jul 2, 2021

Is this something you would be interested in exploring with us? We can make the changes here, or try to change Spacemacs to fit the new logic, or some combination of both, but I figure if we want to preserve the existing integration between these projects, we should probably make that decision explicitly.

Sure! Can you tell me what features are broken? I may did a bad job on compatibility. Let me take some time to investigate it!

In other news, it looks like you are now using run-with-timer instead of run-with-idle-timer:

I have tried run-with-idle-timer and it indeed degrade the performance a bit yet I think it improves some of the user experience from my observations. Can you tell me what feature is broken in Spacemacs and it's cause by the changes? 😕

@alexalekseyenko
Copy link
Author

alexalekseyenko commented Jul 2, 2021

Awesome, thank you! This is what makes the Emacs community great.

The main discussion seems to be happening here:
syl20bnr/spacemacs#14880
if we continue the conversation there, we may be able to get more eyeballs on it.

In short, it looks like we're using ahs-idle-timer to suppress the default highlighting behavior and ahs-highlight-now to then manually trigger it.

Spacemacs wraps auto-highlight-symbol here:
https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bspacemacs/spacemacs-navigation/funcs.el#L53-L211
and then exposes it here:
https://github.com/syl20bnr/spacemacs/blob/532ad2567cba1d57d09e102c385315e7cfa829ec/layers/%2Bspacemacs/spacemacs-navigation/packages.el#L73-L157
creating a transient state and integrating some other functionality, such as iedit, isearch, and symbol-overlay.

The above issue was initially opened because the highlighting suppression broke, but there's more to it than that:

  • the [admittedly delicate] coordination between iedit, isearch, and symbol-overlay is no longer working as expected
  • the above results in bad states where users can't get back into evil mode, highlighting gets stuck, etc.
  • performance seems to have been impacted quite a lot

@duianto
Copy link

duianto commented Jul 3, 2021

A Spacemacs PR is pending with a possible fix to the symbol highlighting issues.
Fix symbol highlighting syl20bnr/spacemacs#14892

@madand
Copy link

madand commented Jul 5, 2021

The previous author has a typo in the face defalt -> default.

@jcs090218 FYI, this seemingly innocent fix breaks any downstream theme that customizes ahs-plugin-defalt-face. At least, spacemacs-theme (fix pending) and solarized-emacs are affected.

@duianto
Copy link

duianto commented Jul 8, 2021

The Spacemacs PR has been merged: Fix symbol highlighting syl20bnr/spacemacs#14892

Symbol highlighting is now disabled on startup.

And the symbol highlighting key bindings should be working as expected again.

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

4 participants