* lisp/progmodes/hideshow.el: Improve Commentary.
This commit is contained in:
parent
025d28ed89
commit
52d9c51816
1 changed files with 37 additions and 39 deletions
|
@ -31,14 +31,14 @@
|
|||
;; are available, implementing block hiding and showing. They (and their
|
||||
;; keybindings) are:
|
||||
;;
|
||||
;; 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-toggle-hiding [(shift mouse-2)]
|
||||
;; hs-hide-initial-comment-block
|
||||
;; `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-toggle-hiding' S-<mouse-2>
|
||||
;; `hs-hide-initial-comment-block'
|
||||
;;
|
||||
;; Blocks are defined per mode. In c-mode, c++-mode and java-mode, they
|
||||
;; are simply text between curly braces, while in Lisp-ish modes parens
|
||||
|
@ -50,16 +50,14 @@
|
|||
|
||||
;; * Suggested usage
|
||||
;;
|
||||
;; First make sure hideshow.el is in a directory in your `load-path'.
|
||||
;; You can optionally byte-compile it using `M-x byte-compile-file'.
|
||||
;; Then, add the following to your init file:
|
||||
;; Add the following to your init file:
|
||||
;;
|
||||
;; (load-library "hideshow")
|
||||
;; (add-hook 'X-mode-hook #'hs-minor-mode) ; other modes similarly
|
||||
;; (require 'hideshow)
|
||||
;; (add-hook 'X-mode-hook #'hs-minor-mode) ; other modes similarly
|
||||
;;
|
||||
;; 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
|
||||
;; activated or deactivated, `hs-minor-mode-hook' is run w/ `run-hooks'.
|
||||
;; activated or deactivated, `hs-minor-mode-hook' is run with `run-hooks'.
|
||||
;;
|
||||
;; Additionally, Joseph Eydelnant writes:
|
||||
;; I enjoy your package hideshow.el Version 5.24 2001/02/13
|
||||
|
@ -67,14 +65,14 @@
|
|||
;; toggle hide/show all with a single key.
|
||||
;; Here are a few lines of code that lets me do just that.
|
||||
;;
|
||||
;; (defvar my-hs-hide nil "Current state of hideshow for toggling all.")
|
||||
;; ;;;###autoload
|
||||
;; (defun my-toggle-hideshow-all () "Toggle hideshow all."
|
||||
;; (interactive)
|
||||
;; (setq my-hs-hide (not my-hs-hide))
|
||||
;; (if my-hs-hide
|
||||
;; (hs-hide-all)
|
||||
;; (hs-show-all)))
|
||||
;; (defvar my-hs-hide nil "Current state of hideshow for toggling all.")
|
||||
;; ;;;###autoload
|
||||
;; (defun my-toggle-hideshow-all () "Toggle hideshow all."
|
||||
;; (interactive)
|
||||
;; (setq my-hs-hide (not my-hs-hide))
|
||||
;; (if my-hs-hide
|
||||
;; (hs-hide-all)
|
||||
;; (hs-show-all)))
|
||||
;;
|
||||
;; [Your hideshow hacks here!]
|
||||
|
||||
|
@ -82,12 +80,12 @@
|
|||
;;
|
||||
;; You can use `M-x customize-variable' on the following variables:
|
||||
;;
|
||||
;; - 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
|
||||
;; - `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 with 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
|
||||
|
@ -96,21 +94,21 @@
|
|||
;; 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 ()
|
||||
;; (when (hs-looking-at-block-start-p)
|
||||
;; (hs-hide-level 1))
|
||||
;; (forward-sexp 1))
|
||||
;; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1)
|
||||
;; (defun ttn-hs-hide-level-1 ()
|
||||
;; (when (hs-looking-at-block-start-p)
|
||||
;; (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
|
||||
;; Hideshow works with 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
|
||||
;; in the mode line by modifying the variable `mode-line-format'. For
|
||||
;; example, the following code prepends this info to the mode line:
|
||||
;;
|
||||
;; (unless (memq 'hs-headline mode-line-format)
|
||||
;; (setq mode-line-format
|
||||
;; (append '("-" hs-headline) mode-line-format)))
|
||||
;; (unless (memq 'hs-headline mode-line-format)
|
||||
;; (setq mode-line-format
|
||||
;; (append '("-" hs-headline) mode-line-format)))
|
||||
;;
|
||||
;; See documentation for `mode-line-format' for more info.
|
||||
;;
|
||||
|
@ -121,8 +119,8 @@
|
|||
;;
|
||||
;; 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.
|
||||
;; respectively. All hooks are run with `run-hooks'. See the
|
||||
;; documentation for each variable or hook for more information.
|
||||
;;
|
||||
;; Normally, hideshow tries to determine appropriate values for block
|
||||
;; and comment definitions by examining the buffer's major mode. If
|
||||
|
|
Loading…
Add table
Reference in a new issue