Created
October 13, 2011 00:08
-
-
Save portown/1283006 to your computer and use it in GitHub Desktop.
Emacs の hideshow で全てのブロックを再帰的に隠す関数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; recursive-hideshow.el | |
(require 'hideshow) | |
(defun jiros--hs-hide-all-recursive-work (minp maxp) | |
(goto-char minp) | |
(when (hs-find-block-beginning) | |
(setq minp (1+ (point))) | |
(funcall hs-forward-sexp-func 1) | |
(setq maxp (1- (point))) | |
(goto-char minp)) | |
(while (and (< (point) maxp) | |
(re-search-forward hs-block-start-regexp maxp t)) | |
(let* ((minp (match-beginning hs-block-start-mdata-select)) | |
(maxp (save-excursion (goto-char minp) (funcall hs-forward-sexp-func 1) (point)))) | |
(jiros--hs-hide-all-recursive-work (1+ minp) (1- maxp)) | |
(goto-char minp) | |
(hs-hide-block-at-point t))) | |
(goto-char maxp)) | |
(defun jiros-hs-hide-all-recursive () | |
"hide all blocks recursively." | |
(interactive) | |
(save-excursion | |
(jiros--hs-hide-all-recursive-work (point-min) (point-max)) | |
)) | |
(provide 'recursive-hideshow) | |
;; EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment