comparison lisp/modes/hideshow.el @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents 43dd3413c7c7
children
comparison
equal deleted inserted replaced
188:e29a8e7498d9 189:489f57a838ef
82 (require 'easymenu) 82 (require 'easymenu)
83 83
84 ;;;---------------------------------------------------------------------------- 84 ;;;----------------------------------------------------------------------------
85 ;;; user-configurable variables 85 ;;; user-configurable variables
86 86
87 (defvar hs-unbalance-handler-method 'top-level 87 (defgroup hideshow nil
88 "Selectively display blocks of code."
89 :prefix "hs-"
90 :group 'outlines
91 :group 'tools)
92
93
94 ;;;###autoload
95 (defcustom hs-minor-mode nil
96 "Non-nil if using hideshow mode as a minor mode of some other mode.
97 Use the command `hs-minor-mode' to toggle this variable."
98 :type 'boolean
99 :set (lambda (symbol value)
100 (hs-minor-mode (or value 0)))
101 :initialize 'custom-initialize-default
102 :require 'hideshow
103 :group 'hideshow)
104
105 (defcustom hs-unbalance-handler-method 'top-level
88 "*Symbol representing how \"unbalanced parentheses\" should be handled. 106 "*Symbol representing how \"unbalanced parentheses\" should be handled.
89 This error is usually signaled by `hs-show-block'. One of four values: 107 This error is usually signaled by `hs-show-block'. One of four values:
90 `top-level', `next-line', `signal' or `ignore'. Default is `top-level'. 108 `top-level', `next-line', `signal' or `ignore'. Default is `top-level'.
91 109
92 - `top-level' -- Show top-level block containing the currently troublesome 110 - `top-level' -- Show top-level block containing the currently troublesome
94 - `next-line' -- Use the fact that, for an already hidden block, its end 112 - `next-line' -- Use the fact that, for an already hidden block, its end
95 will be on the next line. Attempt to show this block. 113 will be on the next line. Attempt to show this block.
96 - `signal' -- Pass the error through, stopping execution. 114 - `signal' -- Pass the error through, stopping execution.
97 - `ignore' -- Ignore the error, continuing execution. 115 - `ignore' -- Ignore the error, continuing execution.
98 116
99 Values other than these four will be interpreted as `signal'.") 117 Values other than these four will be interpreted as `signal'."
100 118 :type '(radio (const :tag "Show top-level block" top-level)
101 (defvar hs-special-modes-alist '((c-mode "{" "}") 119 (const :tag "Show block to next line" next-line)
120 (sexp :format "%t\n" :tag "Signal the error" signal)
121 (const :tag "Ignore the error" ignore))
122 :group 'hideshow)
123
124 (defcustom hs-special-modes-alist '((c-mode "{" "}")
102 (c++-mode "{" "}")) 125 (c++-mode "{" "}"))
103 "*Alist of the form (MODE START-RE END-RE FORWARD-SEXP-FUNC). 126 "*Alist of the form (MODE START-RE END-RE FORWARD-SEXP-FUNC).
104 If present, hideshow will use these values for the start and end regexps, 127 If present, hideshow will use these values for the start and end regexps,
105 respectively. Since Algol-ish languages do not have single-character 128 respectively. Since Algol-ish languages do not have single-character
106 block delimiters, the function `forward-sexp' which is used by hideshow 129 block delimiters, the function `forward-sexp' which is used by hideshow
114 For example: 137 For example:
115 138
116 \t(pushnew '(simula-mode \"begin\" \"end\" simula-next-statement) 139 \t(pushnew '(simula-mode \"begin\" \"end\" simula-next-statement)
117 \t hs-special-modes-alist :test 'equal) 140 \t hs-special-modes-alist :test 'equal)
118 141
119 Note that the regexps should not contain leading or trailing whitespace.") 142 Note that the regexps should not contain leading or trailing whitespace."
120 143 :type 'sexp ; too hard to do right
121 (defvar hs-hide-hook nil 144 :group 'hideshow)
122 "*Hooks called at the end of `hs-hide-all' and `hs-hide-block'.") 145
123 146 (defcustom hs-hide-hook nil
124 (defvar hs-show-hook nil 147 "*Hooks called at the end of `hs-hide-all' and `hs-hide-block'."
148 :type 'hook
149 :group 'hideshow)
150
151 (defcustom hs-show-hook nil
125 "*Hooks called at the end of commands to show text. 152 "*Hooks called at the end of commands to show text.
126 These commands include `hs-show-all', `hs-show-block' and `hs-show-region'.") 153 These commands include `hs-show-all', `hs-show-block' and `hs-show-region'."
127 154 :type 'hook
128 (defvar hs-minor-mode-prefix "\C-c" 155 :group 'hideshow)
129 "*Prefix key to use for hideshow commands in hideshow minor mode.") 156
157 (defcustom hs-minor-mode-prefix "\C-c"
158 "*Prefix key to use for hideshow commands in hideshow minor mode."
159 :type 'hook
160 :group 'hideshow)
130 161
131 162
132 ;;;---------------------------------------------------------------------------- 163 ;;;----------------------------------------------------------------------------
133 ;;; internal variables 164 ;;; internal variables
134 165
135 ;;;###autoload
136 (defvar hs-minor-mode nil
137 "Non-nil if using hideshow mode as a minor mode of some other mode.
138 Use the command `hs-minor-mode' to toggle this variable.")
139 166
140 (defvar hs-minor-mode-map (make-sparse-keymap) 167 (defvar hs-minor-mode-map (make-sparse-keymap)
141 "Mode map for hideshow minor mode.") 168 "Mode map for hideshow minor mode.")
142 169
143 (easy-menu-define 170 (easy-menu-define