This package is a family of global minor modes that persist folds made by various existing (mostly) overlay-based folding systems, saving them to the disk and reapplying upon file open. Currently supported:
- outline-mode / outline-minor-mode
- org-mode (including org 9.6+ text prop folds)
- origami.el
- hideshow
- ts-fold
Rationale: there are billions of different types of folds in emacs, and very few of the packages implement persistence. It makes sense for fold persistence to be abstracted out into a separate package, both for economic reasons and for consistency of usage.
(use-package savefold
:init
(setq savefold-backends '(outline org origami hideshow))
(setq savefold-directory (locate-user-emacs-file "savefold")) ;; default
:config
(savefold-mode 1))
Notes:
- Folding systems which are not a part of Emacs (eg. origami) have to be installed separately, if their savefold backend is to be used.
- For org: setting
org-startup-folded
to'showeverything
is recommended for proper support.
Configuration:
savefold-backends
(default:'(outline)
) is a list of backends to be enabled bysavefold-mode
.savefold-directory
(default:(locate-user-emacs-file "savefold")
) is the directory where fold data is saved.
Please feel free to contribute support for other folding systems. Suggestions and comments are also very welcome.
Development guidelines:
- Savefold uses Eask for environment management and Buttercup for testing.
- Savefold supports Emacs versions 28, 29, and 30.
- If you’re adding new functionality, please also create the relevant tests.
Before sending a PR, ensure (within reason):
- All tests pass:
eask test buttercup
- Compilation without warnings:
eask compile
- Declarations are true:
eask lint declare
- Package is well behaved:
eask lint package