fix(fold): make fold functions consistent by SouthFox-D · Pull Request #8197 · doomemacs/doomemacs · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

fix(fold): make fold functions consistent #8197

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SouthFox-D
Copy link

The +fold/{open,close}-all functions prioritized the ts-fold package, while +fold/{toggle,open,close} prioritized the hideshow package.

This will break +fold/{toggle,open,close} for using +fold/close-all buffer when tree-sitter is enabled.


@KendrickLamarck
Copy link
Contributor

Nice, I just saw this as I wanted to create my own PR with the same fix. One question:

The order in +fold/{open,close}-all is ts-fold -> vimish-fold -> hideshow -> outline. Should the order in +fold/{toggle,open,close} be the same? You have outline and hideshow swapped right now. I don't know if it makes a difference.

I found a few other issues with fold as well:

  • +fold/open-rec acts like +fold/open-all because the (beg end) arguments are unused in some places. I can make my own PR for this.
  • +fold/next doesn't work, but +fold/previous does. Still need to figure this out.

The +fold/{open,close}-all functions prioritized the ts-fold package,
while +fold/{toggle,open,close} prioritized the hideshow package.
@SouthFox-D
Copy link
Author

The order in +fold/{open,close}-all is ts-fold -> vimish-fold -> hideshow -> outline. Should the order in +fold/{toggle,open,close} be the same? You have outline and hideshow swapped right now. I don't know if it makes a difference.

Updated. Thanks for the reminder.

* `+fold/next` doesn't work, but `+fold/previous` does. Still need to figure this out.

I think the reason for this is that the (overlays-in (point) (point-max)) for +fold/next always includes the current point's fold, thus causing it to get stuck in place.

A quick fix might be:

@@ -275,7 +275,8 @@ region."
                                        (eq (overlay-get ov 'creator) 'ts-fold))
                                      ;; `overlays-in' does not provide a list that is sorted
                                      ;; (in the way we need it atleast) so we need to sort it based on direction
-                                     (cl-sort (apply #'overlays-in arg-list) comp-fun :key #'overlay-start))))
+                                     (cl-sort (apply #'overlays-in arg-list) comp-fun :key #'overlay-start)))
+                               (ovs (if (> count 0) (cdr ovs) ovs)))
                           (if (and ovs (<= (abs count) (length ovs)))
                               (goto-char (overlay-start (nth (- (abs count) 1) ovs))))))))
            if (save-excursion (funcall fn))

hlissner added a commit that referenced this pull request May 15, 2025
BREAKING CHANGE: This rewrites the :tools tree-sitter module to use
treesit instead of tree-sitter.el. Users will need to adapt to treesit
and remove any tree-sitter-specific config in their dotfiles.

Ref: #7623
Ref: #7742
Ref: #8197
@hlissner hlissner added is:bug Something isn't working as intended module:editor/fold Pertains to Doom's :editor fold module was:moved Is, was, or will be addressed elsewhere labels May 15, 2025
@hlissner hlissner marked this pull request as draft May 15, 2025 11:49
@hlissner hlissner added this to the modules v25.06 milestone May 15, 2025
@hlissner hlissner linked an issue Jun 2, 2025 that may be closed by this pull request
4 tasks
@hlissner hlissner removed a link to an issue Jun 2, 2025
4 tasks
@hlissner hlissner linked an issue Jun 2, 2025 that may be closed by this pull request
4 tasks
@hlissner hlissner removed a link to an issue Jun 2, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Something isn't working as intended module:editor/fold Pertains to Doom's :editor fold module was:moved Is, was, or will be addressed elsewhere
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.