aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen <[email protected]>2000-09-23 02:37:50 +0000
committerThien-Thi Nguyen <[email protected]>2000-09-23 02:37:50 +0000
commit9b4a7800433b33bc402676e17da152f1e358bf4f (patch)
treea601a7f4f2be6257df4de34dfe8fa7c492fd0e66
parent0c356565b96bc0ecd249a5beee403dff3d00b917 (diff)
Update author email address.
Generally, sync w/ maintainer version 5.22. (hs-hide-all-non-comment-function): New var. (hs-hide-hook, hs-show-hook, hs-minor-mode): Update docstrings. (hs-hide-all): Use `hs-hide-all-non-comment-function'. (hs-show-region): Delete this command. (hs-minor-mode-map): Change bindings to leave "C-c LETTER" alone.
-rw-r--r--lisp/ChangeLog99
-rw-r--r--lisp/progmodes/hideshow.el191
2 files changed, 154 insertions, 136 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c6b0221168..b1d1fad795 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2000-09-23 Thien-Thi Nguyen <[email protected]>
+
+ * progmodes/hideshow.el: Update author email address.
+ Generally, sync w/ maintainer version 5.22.
+
+ (hs-hide-all-non-comment-function): New var.
+ (hs-hide-hook, hs-show-hook, hs-minor-mode): Update docstrings.
+ (hs-hide-all): Use `hs-hide-all-non-comment-function'.
+ (hs-show-region): Delete this command.
+ (hs-minor-mode-map): Change bindings to leave "C-c LETTER" alone.
+
2000-09-22 Dave Love <[email protected]>
* hl-line.el (hl-line-overlay): Don't make it buffer-local.
@@ -17,10 +28,10 @@
2000-09-22 Andre Spiegel <[email protected]>
- * vc.el (vc-switch-backend): Signal an error if the file is not
+ * vc.el (vc-switch-backend): Signal an error if the file is not
registered under the new backend.
- * vc-rcs.el (vc-rcs-checkin): Fix bug that prevented check-in
+ * vc-rcs.el (vc-rcs-checkin): Fix bug that prevented check-in
without explicit revision number.
2000-09-21 Stefan Monnier <[email protected]>
@@ -40,14 +51,14 @@
* startup.el (command-line): If frame was created with a non-zero
tool-bar-lines parameter, switch tool-bar-mode on.
-
+
* add-log.el (change-log-date-face, change-log-name-face)
(change-log-email-face, change-log-file-face)
(change-log-list-face, change-log-conditionals-face)
(change-log-function-face, change-log-acknowledgement-face): New
faces, inheriting from font-lock faces.
(change-log-font-lock-keywords): Use them.
-
+
2000-09-21 Dave Love <[email protected]>
* progmodes/cperl-mode.el (top-level): Clean up
@@ -88,9 +99,9 @@
(vc-rcs-unregister, vc-rcs-receive-file,
vc-rcs-set-non-strict-locking): New functions.
- * vc-hooks.el (vc-name): Force correct computation of the value
+ * vc-hooks.el (vc-name): Force correct computation of the value
in case it is missing.
-
+
2000-09-21 Gerd Moellmann <[email protected]>
* startup.el (fancy-splash-tail): Use a different foreground
@@ -239,7 +250,7 @@
underlined.
2000-09-19 Richard M. Stallman <[email protected]>
-
+
* progmodes/sh-script.el (sh-search-word): Rewritten for
speed.
@@ -268,7 +279,7 @@
(fancy-splash-screens): New functions.
(command-line-1): If display has a `display' frame parameter, has
colors, and we have XPM support, show more fancy splash screens.
-
+
2000-09-19 Dave Love <[email protected]>
* map-ynp.el (map-y-or-n-p): Check use-dialog-box. Don't lose
@@ -295,7 +306,7 @@
(diff-apply-hunk): Try to jump to the line in the source text
corresponding to the position of point in the in the hunk.
- * info.el (Info-title-3-face, Info-title-2-face)
+ * info.el (Info-title-3-face, Info-title-2-face)
(Info-title-1-face): Use face inheritance and relative sizes
instead of hard-wiring things.
@@ -478,7 +489,7 @@
(ansi-color-get-face): Doc change.
(ansi-color-make-face): Removed.
(ansi-color-for-shell-mode): New option.
-
+
2000-09-13 Kenichi Handa <[email protected]>
* international/quail.el (quail-start-translation): Translate KEY
@@ -593,8 +604,8 @@
2000-09-08 Stefan Monnier <[email protected]>
- * vc-sccs.el (vc-sccs-register):
- * vc-rcs.el (vc-rcs-register):
+ * vc-sccs.el (vc-sccs-register):
+ * vc-rcs.el (vc-rcs-register):
* vc-cvs.el (vc-cvs-register): Don't clear file's properties.
* vc.el (vc-register): Clear file's properties.
@@ -643,14 +654,14 @@
2000-09-07 Gerd Moellmann <[email protected]>
* faces.el (color-values): Doc fix.
-
+
* faces.el (frame-set-background-mode): Use frame-parameter
instead of frame-parameters.
* frame.el (filtered-frame-list): Reduce consing.
- (frames-on-display-list): Call frame-parameter instead of
+ (frames-on-display-list): Call frame-parameter instead of
frame-parameters.
-
+
2000-09-07 Kenichi Handa <[email protected]>
* language/devan-util.el (devanagari-to-indian-region): In the
@@ -661,7 +672,7 @@
* menu-bar.el (menu-bar-update-buffers): Call frame-parameter
instead of frame-parameters.
- * faces.el (set-face-attribute): Simplify by calling
+ * faces.el (set-face-attribute): Simplify by calling
internal-set-lisp-face-attribute with FRAME being 0.
* vc.el: Remove `Id' version control keyword.
@@ -725,10 +736,10 @@
(vc-default-merge-news): Removed. The existence of a merge-news
implementation is now checked on caller sites.
- * vc-hooks.el (vc-default-mode-line-string): Removed CVS special
+ * vc-hooks.el (vc-default-mode-line-string): Removed CVS special
case.
- * vc-cvs.el (vc-cvs-mode-line-string): New function, handles the
+ * vc-cvs.el (vc-cvs-mode-line-string): New function, handles the
special case that has been removed from the default in vc-hooks.el.
2000-09-05 Stefan Monnier <[email protected]>
@@ -742,18 +753,18 @@
macro `with-vc-properties' in vc.el.
(vc-file-getprop): Doc fix.
(vc-after-save): Call `vc-dired-resynch-file' only if vc is loaded.
-
+
* vc.el: Require dired-aux during compilation.
(vc-name-assoc-file): Moved to vc-sccs.el.
(with-vc-properties): New macro.
- (vc-checkin, vc-checkout, vc-revert, vc-cancel-version,
+ (vc-checkin, vc-checkout, vc-revert, vc-cancel-version,
vc-finish-steal): Use it.
(vc-cancel-version): Moved RCS-specific code to vc-rcs.el. The call
to the backend-specific function is now supposed to do the checkout,
too.
(vc-log-edit): Handle FILE being nil and added a FIXME for log-edit.
- * vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to
+ * vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to
set file properties; that gets done in the generic code now.
* vc-rcs.el (vc-rcs-uncheck): Renamed to `vc-rcs-cancel-version'.
@@ -812,7 +823,7 @@
2000-09-04 Gerd Moellmann <[email protected]>
* vc.el (vc-dired-resynch-file): Add autoload cookie.
-
+
* vc.el (toplevel): Require `dired' at run-time for dired-mode-map.
* Makefile.in (DONTCOMPILE): Fix typo in file name.
@@ -847,7 +858,7 @@
* vc-cvs.el (vc-cvs-show-log-entry): New function.
- * vc-hooks.el (vc-default-mode-line-string): Show state
+ * vc-hooks.el (vc-default-mode-line-string): Show state
`needs-patch' as a `-' too.
2000-09-04 Andre Spiegel <[email protected]>
@@ -863,7 +874,7 @@
(vc-retrieve-snapshot): Corrected prompt order.
* vc-hooks.el (vc-after-save): Call vc-dired-resynch-file.
-
+
* vc-cvs.el (vc-cvs-stay-local): Allow it to be a hostname regexp
as well.
(vc-cvs-remote-p): Renamed to vc-cvs-stay-local-p. Handle
@@ -872,7 +883,7 @@
(vc-cvs-could-register): New function.
(vc-cvs-retrieve-snapshot): Parse "cvs update" output, keep file
properties up-to-date.
-
+
* vc-rcs.el (vc-rcs-register): If there is no RCS subdir, ask the
user whether to create one.
@@ -915,7 +926,7 @@
(vc-cvs-dir-state-heuristic): New function, subroutine of the above.
(vc-cvs-parse-entry): New function, also to be used in
vc-cvs-registered.
-
+
2000-09-04 Stefan Monnier <[email protected]>
* vc.el (vc-revert-buffer): Hide the frame for dedicated windows
@@ -930,7 +941,7 @@
* vc-sccs.el (vc-sccs-update-changelog): Dummy implementation that
simply signals an error.
-
+
2000-09-04 Stefan Monnier <[email protected]>
* vc-cvs.el (vc-cvs-checkout): Slight restructuring to make the
@@ -953,7 +964,7 @@
* vc-*.el (vc-*-checkout): Switch off coding systems for checkout
via stdout. (Merge from main line.)
-
+
2000-09-04 Stefan Monnier <[email protected]>
* vc.el (vc-finish-logentry): Thinko in the "same comment"
@@ -2369,7 +2380,7 @@
2000-08-31 Peter Breton <[email protected]>
- * filecache.el (file-cache-add-directory-using-find): Don't quote
+ * filecache.el (file-cache-add-directory-using-find): Don't quote
wildcards on MS-DOS. Suggested by Eli Zaretskii <[email protected]>.
2000-08-31 Kenichi Handa <[email protected]>
@@ -2420,7 +2431,7 @@
* comint.el (comint-send-input): Create overlays using the proper
front/read-advance arguments.
-
+
2000-08-29 Vinicius Jose Latorre <[email protected]>
* ps-print.el: Even/odd pages printing. Doc fix.
@@ -2435,7 +2446,7 @@
(ebnf-user-arrow): Change variable customization to sexp.
(ebnf-user-arrow): Function eliminated.
(ebnf-eps-finish-and-write, ebnf-insert-ebnf-prologue): Code fix.
-
+
2000-08-29 Kenichi Handa <[email protected]>
* help.el (help-xref-mule-regexp): New variable.
@@ -2522,9 +2533,9 @@
entries (used for group/user name aliasing to multiple IDs) are
ignored.
- * eshell/em-xtra.el (eshell/expr):
- * eshell/em-unix.el (eshell/du, eshell/cat, eshell/make)
- (eshell-grep, eshell/diff, eshell/locate):
+ * eshell/em-xtra.el (eshell/expr):
+ * eshell/em-unix.el (eshell/du, eshell/cat, eshell/make)
+ (eshell-grep, eshell/diff, eshell/locate):
* eshell/em-dirs.el (eshell-dirs-substitute-cd): Flatten the
argument list, before passing it to the system command.
@@ -2556,8 +2567,8 @@
* eshell/esh-mode.el (eshell-mode): Disable auto-fill-function in
Eshell buffers.
- * eshell/esh-var.el (eshell-interpolate-variable):
- * eshell/esh-mode.el (eshell-move-argument):
+ * eshell/esh-var.el (eshell-interpolate-variable):
+ * eshell/esh-mode.el (eshell-move-argument):
* eshell/em-unix.el (eshell-du-sum-directory):
* eshell/em-rebind.el (eshell-delchar-or-maybe-eof):
* eshell/em-ls.el (eshell-ls-decorated-name): Use /= instead of
@@ -2573,7 +2584,7 @@
Don't convert \n into \0177 in memory.
(eshell-read-history, eshell-write-history): Convert \n to \0177,
and back again, when reading and writing.
-
+
2000-08-28 Eli Zaretskii <[email protected]>
* eshell/esh-util.el (eshell-processp): Added to relieve constant
@@ -2617,7 +2628,7 @@
* locate.el (locate): Cleaned up locate command's interactive prompting
Thanks to Fran,Ag(Bois_Pinard <[email protected]> for suggestions.
- * filecache.el (file-cache-case-fold-search): New variable
+ * filecache.el (file-cache-case-fold-search): New variable
(file-cache-assoc-function): New variable
(file-cache-minibuffer-complete): Use file-cache-assoc-function.
Use file-cache-case-fold-search variable
@@ -2739,7 +2750,7 @@
* comint.el (comint-output-filter): Compare end of
comint-last-output-overlay with the start of the newly inserted
text, not the end, when deciding whether to extend it.
- Set saved-point's insertion type to advance after insertion.
+ Set saved-point's insertion type to advance after insertion.
* shell.el (shell-font-lock-keywords): Remove prompt highlighting,
since this is now done independently of font-lock mode.
@@ -2753,7 +2764,7 @@
(server-buffer-done): If server-kill-new-buffers is t, kill the
buffer, unless it was already present before visiting it with
Emacs server.
-
+
2000-08-21 Eli Zaretskii <[email protected]>
* man.el (Man-init-defvars): Don't reset Man-fontify-manpage-flag,
@@ -2973,7 +2984,7 @@
* loadhist.el (unload-feature): Typo.
- * finder.el (finder-compile-keywords):
+ * finder.el (finder-compile-keywords):
* cus-dep.el (custom-make-dependencies): Add local-variable settings
to the generated file.
@@ -2982,8 +2993,8 @@
* play/landmark.el:
* options.el (Edit-options-{set,toggle,t,nil}):
- * mail/mailabbrev.el (mail-abbrevs-mode):
- * textmodes/tex-mode.el (tex-expand-files):
+ * mail/mailabbrev.el (mail-abbrevs-mode):
+ * textmodes/tex-mode.el (tex-expand-files):
* textmodes/outline.el (outline-minor-mode): Don't quote lambda.
* term/bg-mouse.el (bg-mouse-report): screen-height -> frame-height.
@@ -2991,7 +3002,7 @@
* emacs-lisp/ewoc.el (ewoc-locate): Default POS to (point).
(ewoc-goto-prev, ewoc-goto-next): Remove arg POS.
Allow going past the last element.
- * pcvs.el (cvs-mode-previous-line, cvs-mode-next-line, cvs-mode-mark)
+ * pcvs.el (cvs-mode-previous-line, cvs-mode-next-line, cvs-mode-mark)
(cvs-mode-unmark-up, cvs-get-marked): Update calls to ewoc.
(cvs-mouse-toggle-mark): Don't move point.
(cvs-revert-if-needed): Avoid re-eval of local variables and modes.
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 6fccb860d4..f47e5cd7a7 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -2,10 +2,10 @@
;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation
-;; Author: Thien-Thi Nguyen <[email protected]>
+;; Author: Thien-Thi Nguyen <[email protected]>
;; Dan Nicolaescu <[email protected]>
;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines
-;; Maintainer-Version: 5.11
+;; Maintainer-Version: 5.22
;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning
;; This file is part of GNU Emacs.
@@ -33,13 +33,12 @@
;; are available, implementing block hiding and showing. They (and their
;; keybindings) are:
;;
-;; hs-hide-block C-c h
-;; hs-show-block C-c s
-;; hs-hide-all C-c H
-;; hs-show-all C-c S
-;; hs-show-region C-c R
-;; hs-hide-level C-c L
-;; hs-toggle-hiding
+;; hs-hide-block C-c C-h
+;; hs-show-block C-c C-s
+;; hs-hide-all C-c C-M-h
+;; hs-show-all C-c C-M-s
+;; hs-hide-level C-c C-l
+;; hs-toggle-hiding C-c C-c
;; hs-mouse-toggle-hiding [(shift button-2)]
;; hs-hide-initial-comment-block
;;
@@ -55,10 +54,25 @@
;;
;; You can use `M-x customize-variable' on the following variables:
;;
-;; hs-hide-comments-when-hiding-all -- self-explanatory!
-;; hs-isearch-open -- what kind of hidden blocks to
+;; - hs-hide-comments-when-hiding-all -- self-explanatory!
+;; - hs-hide-all-non-comment-function -- if non-nil, when doing a
+;; `hs-hide-all', this function
+;; is called w/ no arguments
+;; - hs-isearch-open -- what kind of hidden blocks to
;; open when doing isearch
;;
+;; Some languages (e.g., Java) are deeply nested, so the normal behavior
+;; of `hs-hide-all' (hiding all but top-level blocks) results in very
+;; little information shown, which is not very useful. You can use the
+;; variable `hs-hide-all-non-comment-function' to implement your idea of
+;; what is more useful. For example, the following code shows the next
+;; nested level in addition to the top-level:
+;;
+;; (defun ttn-hs-hide-level-1 ()
+;; (hs-hide-level 1)
+;; (forward-sexp 1))
+;; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1)
+;;
;; Hideshow works w/ incremental search (isearch) by setting the variable
;; `hs-headline', which is the line of text at the beginning of a hidden
;; block that contains a match for the search. You can have this show up
@@ -74,10 +88,12 @@
;; Hooks are run after some commands:
;;
;; hs-hide-hook in hs-hide-block, hs-hide-all, hs-hide-level
-;; hs-show-hook hs-show-block, hs-show-all, hs-show-region
+;; hs-show-hook hs-show-block, hs-show-all
;;
-;; All hooks are run w/ `run-hooks'. See docs for each variable or hook
-;; for more info.
+;; One of `hs-hide-hook' or `hs-show-hook' is run for the toggling
+;; commands when the result of the toggle is to hide or show blocks,
+;; respectively. All hooks are run w/ `run-hooks'. See docs for each
+;; variable or hook for more info.
;;
;; Normally, hideshow tries to determine appropriate values for block
;; and comment definitions by examining the buffer's major mode. If
@@ -102,7 +118,8 @@
;; Then, add the following to your ~/.emacs:
;;
;; (load-library "hideshow")
-;; (add-hook 'X-mode-hook 'hs-minor-mode) ; other modes similarly
+;; (add-hook 'X-mode-hook ; other modes similarly
+;; '(lambda () (hs-minor-mode 1)))
;;
;; where X = {emacs-lisp,c,c++,perl,...}. You can also manually toggle
;; hideshow minor mode by typing `M-x hs-minor-mode'. After hideshow is
@@ -121,37 +138,39 @@
;; (3) Hideshow 5.x is developed and tested on GNU Emacs 20.4.
;; XEmacs compatibility may have bitrotted since 4.29.
;;
+;; (4) Some buffers can't be `byte-compile-file'd properly. This is because
+;; `byte-compile-file' inserts the file to be compiled in a temporary
+;; buffer and switches `normal-mode' on. In the case where you have
+;; `hs-hide-initial-comment-block' in `hs-minor-mode-hook', the hiding of
+;; the initial comment sometimes hides parts of the first statement (seems
+;; to be only in `normal-mode'), so there are unbalanced "(" and ")".
+;;
+;; The workaround is to clear `hs-minor-mode-hook' when byte-compiling:
+;;
+;; (defadvice byte-compile-file (around
+;; byte-compile-file-hideshow-off
+;; act)
+;; (let ((hs-minor-mode-hook nil))
+;; ad-do-it))
+
;; Correspondance welcome; please indicate version number. Send bug
-;; reports and inquiries to <[email protected]>.
+;; reports and inquiries to <[email protected]>.
;; * Thanks
;;
;; Thanks go to the following people for valuable ideas, code and
;; bug reports.
;;
-;; [email protected] Dean Andrews
-;; [email protected] Alf-Ivar Holm
-;; [email protected] Holger Bauer
-;; [email protected] Christoph Conrad
-;; [email protected] Dave Love
-;; [email protected] Dirk Herrmann
-;; [email protected] Gael Marziou
-;; [email protected] Jan Djarv
-;; [email protected] Guillaume Leray
-;; [email protected] Moody Ahmad
-;; [email protected] Preston F. Crow
-;; [email protected] Lars Lindberg
-;; [email protected] Reto Zimmermann
-;; [email protected] Keith Sheffield
-;; [email protected] Chew Meng Kuan
-;; [email protected] Tony Lam
-;; [email protected] Pete Ware
+;; Dean Andrews, Alf-Ivar Holm, Holger Bauer, Christoph Conrad, Dave
+;; Love, Dirk Herrmann, Gael Marziou, Jan Djarv, Guillaume Leray,
+;; Moody Ahmad, Preston F. Crow, Lars Lindberg, Reto Zimmermann,
+;; Keith Sheffield, Chew Meng Kuan, Tony Lam, Pete Ware, Fran�ois Pinard
;;
-;; Special thanks go to Dan Nicolaescu <[email protected]>, who reimplemented
-;; hideshow using overlays (rather than selective display), added isearch
-;; magic, folded in custom.el compatibility, generalized comment handling,
-;; incorporated mouse support, and maintained the code in general. Version
-;; 4.0 is largely due to his efforts.
+;; Special thanks go to Dan Nicolaescu, who reimplemented hideshow using
+;; overlays (rather than selective display), added isearch magic, folded
+;; in custom.el compatibility, generalized comment handling, incorporated
+;; mouse support, and maintained the code in general. Version 4.0 is
+;; largely due to his efforts.
;; * History
;;
@@ -236,13 +255,18 @@ If any of the elements is left nil or omitted, hideshow tries to guess
appropriate values. The regexps should not contain leading or trailing
whitespace. Case does not matter.")
+(defvar hs-hide-all-non-comment-function nil
+ "*Function called if non-nil when doing `hs-hide-all' for non-comments.")
+
(defvar hs-hide-hook nil
"*Hook called (with `run-hooks') at the end of commands to hide text.
-These commands include `hs-hide-all', `hs-hide-block' and `hs-hide-level'.")
+These commands include the toggling commands (when the result is to hide
+a block), `hs-hide-all', `hs-hide-block' and `hs-hide-level'.")
(defvar hs-show-hook nil
"*Hook called (with `run-hooks') at the end of commands to show text.
-These commands include `hs-show-all', `hs-show-block' and `hs-show-region'.")
+These commands include the toggling commands (when the result is to show
+a block), `hs-show-all' and `hs-show-block'..")
;;---------------------------------------------------------------------------
;; internal variables
@@ -637,39 +661,34 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments."
(save-excursion
(hs-flag-region (point-min) (point-max) nil) ; eliminate weirdness
(goto-char (point-min))
- (if hs-hide-comments-when-hiding-all
- (let ((c-reg nil)
- (count 0)
- (block-and-comment-re
- (concat "\\("
- hs-block-start-regexp
- "\\)\\|\\("
- hs-c-start-regexp
- "\\)")))
- (while (re-search-forward block-and-comment-re (point-max) t)
- (if (match-beginning 1) ;; we have found a block beginning
- (progn
- (goto-char (match-beginning 1))
- (hs-hide-block-at-point t)
- (message "Hiding ... %d" (setq count (1+ count))))
- ;;found a comment
- (setq c-reg (hs-inside-comment-p))
- (if (and c-reg (car c-reg))
- (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1)
- (progn
- (hs-hide-block-at-point t c-reg)
- (message "Hiding ... %d" (setq count (1+ count))))
- (goto-char (nth 1 c-reg)))))))
- (let ((count 0)
- (buf-size (buffer-size)))
- (while
+ (let ((count 0)
+ (re (concat "\\("
+ hs-block-start-regexp
+ "\\)"
+ (if hs-hide-comments-when-hiding-all
+ (concat "\\|\\("
+ hs-c-start-regexp
+ "\\)")
+ ""))))
+ (while (progn
+ (unless hs-hide-comments-when-hiding-all
+ (forward-comment (point-max)))
+ (re-search-forward re (point-max) t))
+ (if (match-beginning 1)
+ ;; we have found a block beginning
(progn
- (forward-comment buf-size)
- (re-search-forward hs-block-start-regexp (point-max) t))
- (goto-char (match-beginning 0))
- (hs-hide-block-at-point t)
- (message "Hiding ... %d" (setq count (1+ count))))))
- (hs-safety-is-job-n))
+ (goto-char (match-beginning 1))
+ (if hs-hide-all-non-comment-function
+ (funcall hs-hide-all-non-comment-function)
+ (hs-hide-block-at-point t)))
+ ;; found a comment, probably
+ (let ((c-reg (hs-inside-comment-p))) ; blech!
+ (when (and c-reg (car c-reg))
+ (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1)
+ (hs-hide-block-at-point t c-reg)
+ (goto-char (nth 1 c-reg))))))
+ (message "Hiding ... %d" (setq count (1+ count)))))
+ (hs-safety-is-job-n))
(beginning-of-line)
(message "Hiding all blocks ... done")
(run-hooks 'hs-hide-hook)))
@@ -741,18 +760,6 @@ See documentation for functions `hs-hide-block' and `run-hooks'."
(hs-safety-is-job-n)
(run-hooks 'hs-show-hook))))
-(defun hs-show-region (beg end)
- "Show all lines from BEG to END, without doing any block analysis.
-Note: `hs-show-region' is intended for use when `hs-show-block' signals
-\"unbalanced parentheses\" and so is an emergency measure only. You may
-become very confused if you use this command indiscriminately.
-The hook `hs-show-hook' is run; see `run-hooks'."
- (interactive "r")
- (hs-life-goes-on
- (hs-flag-region beg end nil)
- (hs-safety-is-job-n)
- (run-hooks 'hs-show-hook)))
-
(defun hs-hide-level (arg)
"Hide all blocks ARG levels below this block.
The hook `hs-hide-hook' is run; see `run-hooks'."
@@ -808,7 +815,7 @@ commands and the hideshow commands are enabled.
The value '(hs . t) is added to `buffer-invisibility-spec'.
The main commands are: `hs-hide-all', `hs-show-all', `hs-hide-block',
-`hs-show-block', `hs-hide-level' and `hs-show-region'. There is also
+`hs-show-block', `hs-hide-level' and `hs-toggle-hiding'. There is also
`hs-hide-initial-comment-block' and `hs-mouse-toggle-hiding'.
Turning hideshow minor mode off reverts the menu bar and the
@@ -853,14 +860,14 @@ Key bindings:
(lambda (ent)
(define-key hs-minor-mode-map (aref ent 2) (aref ent 1))
(if (aref ent 0) ent "-----"))
- ;; I believe there is nothing bound on these keys.
+ ;; These bindings roughly imitate those used by Outline mode.
;; menu entry command key
- '(["Hide Block" hs-hide-block "\C-ch"]
- ["Show Block" hs-show-block "\C-cs"]
- ["Hide All" hs-hide-all "\C-cH"]
- ["Show All" hs-show-all "\C-cS"]
- ["Hide Level" hs-hide-level "\C-cL"]
- ["Show Region" hs-show-region "\C-cR"]
+ '(["Hide Block" hs-hide-block "\C-c\C-h"]
+ ["Show Block" hs-show-block "\C-c\C-s"]
+ ["Hide All" hs-hide-all "\C-c\C-\M-h"]
+ ["Show All" hs-show-all "\C-c\C-\M-s"]
+ ["Hide Level" hs-hide-level "\C-c\C-l"]
+ ["Toggle Hiding" hs-toggle-hiding "\C-c\C-c"]
[nil hs-mouse-toggle-hiding [(shift button2)]]
)))))