Debian Codegraph @

epackage/folding-mode-epackage-xinstall.el

raw
1 (autoload 'folding-mode "folding" "Folding mode" t)
2 (autoload 'turn-off-folding-mode "folding" "Folding mode" t)
3 (autoload 'turn-on-folding-mode "folding" "Folding mode" t)
4 (autoload 'folding-install-hooks "folding")
5
6 ;; This is one time setup. Activate only on-demand.
7 ;;
8 ;; After we find any fold, transfer control to folding-mode.
9 ;; This way we keep it lean, until it's time to load "the package"
10
11 (defun folding-mode-epackage-find-file-hook ()
12 "Activate folding mode for file as needed."
13 (cond
14 ((featurep 'folding)
15 (remove-hook 'find-file-hook 'folding-mode-epackage-find-file-hook)
16 (folding-install-hooks))
17 (t
18 ;; Poor man's fold detection
19 (save-excursion
20 (when (re-search-forward (format "^%s{{{" (or comment-start "")) nil t)
21 (turn-on-folding-mode)
22 (remove-hook 'find-file-hook 'folding-mode-epackage-find-file-hook)
23 (folding-install-hooks))))))
24
25 (if (featurep 'folding)
26 (folding-install-hooks)
27 (add-hook 'find-file-hook 'folding-mode-epackage-find-file-hook))
28
29 (provide 'folding-mode-epackage-xinstall)