-
Notifications
You must be signed in to change notification settings - Fork 260
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
WIP: Getting folding right in Elpy #1398
Conversation
@jorgenschaefer, before I begin to add tests and documentation, do you have any feedback on this ? Notably, I am not sure about the keybindings. Also, It is inspired from here for the leafs hiding and hideshowvis (GPL v2) for the fringe and folding overlays. Not sure if we need to add that as source somewhere. |
This looks really nice. The only general feedback I have is "are you sure you want to maintain this in the future" – any such larger code base will need maintenance to keep up to date with dependent packages. But other than that, nice. The key bindings are pretty standard for Emacs. I never liked C-c @, because @ is "right alt + q" on German keyboards, but that's a general problem. Being standard, I think this is fine. Thank you again for all the great work you do! |
This is a good advice, I will try to keep it simple. I'll stick to the standard key bindings then (not really convenient on the french keyboard as well, but I'll rebind that). |
Thanks for building this! 🙏 I've wanted code folding in elpy for a while, and now I'm running your branch and it works well. Would be nice to have this in master! |
Thanks for the feedback. So If you are saying it's working, I could give it a quick test and merge it. |
346f3cd
to
43a506c
Compare
As for features: The only thing that I want is a function that does "hide all blocks that are either a leaf or at level n", which is like UPDATE: When I run from |
elpy.el
Outdated
(when (hs-find-block-beginning) | ||
(setq beg (1+ (point))) | ||
(funcall hs-forward-sexp-func 1) | ||
(setq end (1- (point)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to move the pointer back to the beginning of the block here.
(setq end (1- (point)))) | |
(setq end (1- (point))) | |
(goto-char beg)) |
29b811c
to
1583632
Compare
54dcf3d
to
fb92d72
Compare
fb92d72
to
08911cb
Compare
@peterewills I finally managed to finish and merge this PR. The folding module is deactivated by default, you will have to activate it trough customize or by adding it to |
instead of having independent module for folding, why don't we just tell user to use external package such us origami https://github.com/gregsexton/origami.el ? |
PR Summary
Follow (old) feature request #240.
This is an attempt to get nice folding functionalities in Elpy.
It is currently based on
hs-minor-mode
and heavily inspired from hideshowvis.Any idea is welcome.
Todo list
Nice folding
Folding docstrings
elpy-folding-toggle-docstrings
to hide all the docstrings in the buffer.elpy-folding-hide-docstring-at-point
functions to hide the docstring at point.Folding comments
DWIM
Selective folding
elpy-folding-hide-leafs
to hide blocks not containing other blocks.Keybindings
elpy-folding-fold-at-point
to fold the active region, the docstring, or the block at point.elpy-folding-toggle-at-point
(toC-c @ p
).elpy-folding-toggle-all-docstrings
(toC-c @ b
).elpy-folding-hide-leafs
(toC-c @ f
).Other modules incompatibilities
Others