Mercurial > emacs
comparison lisp/progmodes/hideshow.el @ 81557:8ee965d8fb17
(hs-hide-all): Use progress reporter.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Fri, 22 Jun 2007 08:40:52 +0000 |
parents | a0461babeddf |
children | b98604865ea0 988f1edc9674 |
comparison
equal
deleted
inserted
replaced
81556:1145822df47e | 81557:8ee965d8fb17 |
---|---|
731 Move point to the beginning of the line, and run the normal hook | 731 Move point to the beginning of the line, and run the normal hook |
732 `hs-hide-hook'. See documentation for `run-hooks'. | 732 `hs-hide-hook'. See documentation for `run-hooks'. |
733 If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." | 733 If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." |
734 (interactive) | 734 (interactive) |
735 (hs-life-goes-on | 735 (hs-life-goes-on |
736 (message "Hiding all blocks ...") | |
737 (save-excursion | 736 (save-excursion |
738 (unless hs-allow-nesting | 737 (unless hs-allow-nesting |
739 (hs-discard-overlays (point-min) (point-max))) | 738 (hs-discard-overlays (point-min) (point-max))) |
740 (goto-char (point-min)) | 739 (goto-char (point-min)) |
741 (let ((count 0) | 740 (let ((spew (make-progress-reporter "Hiding all blocks..." |
741 (point-min) (point-max))) | |
742 (re (concat "\\(" | 742 (re (concat "\\(" |
743 hs-block-start-regexp | 743 hs-block-start-regexp |
744 "\\)" | 744 "\\)" |
745 (if hs-hide-comments-when-hiding-all | 745 (if hs-hide-comments-when-hiding-all |
746 (concat "\\|\\(" | 746 (concat "\\|\\(" |
762 (let ((c-reg (hs-inside-comment-p))) | 762 (let ((c-reg (hs-inside-comment-p))) |
763 (when (and c-reg (car c-reg)) | 763 (when (and c-reg (car c-reg)) |
764 (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1) | 764 (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1) |
765 (hs-hide-block-at-point t c-reg) | 765 (hs-hide-block-at-point t c-reg) |
766 (goto-char (nth 1 c-reg)))))) | 766 (goto-char (nth 1 c-reg)))))) |
767 (message "Hiding ... %d" (setq count (1+ count)))))) | 767 (progress-reporter-update spew (point))) |
768 (progress-reporter-done spew))) | |
768 (beginning-of-line) | 769 (beginning-of-line) |
769 (message "Hiding all blocks ... done") | |
770 (run-hooks 'hs-hide-hook))) | 770 (run-hooks 'hs-hide-hook))) |
771 | 771 |
772 (defun hs-show-all () | 772 (defun hs-show-all () |
773 "Show everything then run `hs-show-hook'. See `run-hooks'." | 773 "Show everything then run `hs-show-hook'. See `run-hooks'." |
774 (interactive) | 774 (interactive) |