Skip to content

Prior fix to outline-regexp prevents code folding #684

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

Closed
jeffvalk opened this issue Dec 9, 2024 · 4 comments · Fixed by #685
Closed

Prior fix to outline-regexp prevents code folding #684

jeffvalk opened this issue Dec 9, 2024 · 4 comments · Fixed by #685
Labels

Comments

@jeffvalk
Copy link
Contributor

jeffvalk commented Dec 9, 2024

outline-regexp was changed in b1ea6de to address #550. The updated regexp deleted one pattern too many.

tl;dr: In order to both fix the issue described in #550 and enable unified comment and code folding using bicycle (or a similar package), outline-regexp should be changed from ;;;;* to ;;;;* \\|(.

bicycle uses outline-regexp to identify code blocks as well as headings. It's just a light wrapper that unifies two built-in folding packages:outline-minor-mode (for comments) and hideshow (for code). Removing the alternate pattern \\|( in outline-regexp prevents bicycle from finding top-level code blocks to fold; it only permits comment folding. The alternate pattern to match top-level code blocks can be added back to outline-regexp without effecting the fix for outline-insert-heading:

;; Preserve the fix to issue #550, while enabling code + comment folding
(setq-local outline-regexp ";;;;* \\|(") 

Originally posted by @jeffvalk in #550 (comment)

@bbatsov
Copy link
Member

bbatsov commented Dec 9, 2024

@jeffvalk Long time, no see!

I'm fine your proposal - feel free to open a PR with the suggested change.

@bbatsov bbatsov added the bug label Dec 9, 2024
@jeffvalk
Copy link
Contributor Author

jeffvalk commented Dec 9, 2024

Hey @bbatsov -- hope all is well!

PR coming up...

@jeffvalk
Copy link
Contributor Author

It's worth mentioning that this change does alter the behavior of outline-promote and outline-demote...though not meaningfully. These functions didn't work correctly in clojure-mode before the change, and they don't after either. 😄 Of course, they also don't work correctly in emacs-lisp-mode, so presumably they're just not something anyone uses in a Lisp.

@bbatsov
Copy link
Member

bbatsov commented Dec 11, 2024

Thanks for all the details and the quick fix! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants