comparison lisp/utils/id-select.el @ 124:9b50b4588a93 r20-1b15

Import from CVS: tag r20-1b15
author cvs
date Mon, 13 Aug 2007 09:26:39 +0200
parents 441bb1e64a06
children 1370575f1259
comparison
equal deleted inserted replaced
123:c77884c6318d 124:9b50b4588a93
162 162
163 ;;; ************************************************************************ 163 ;;; ************************************************************************
164 ;;; Public variables 164 ;;; Public variables
165 ;;; ************************************************************************ 165 ;;; ************************************************************************
166 166
167 (defvar id-select-brace-modes 167 (defgroup id-select nil
168 "Select larger and larger syntax-driven regions in a buffer"
169 :group 'mouse)
170
171
172 (defcustom id-select-brace-modes
168 '(c++-mode c-mode java-mode objc-mode perl-mode tcl-mode) 173 '(c++-mode c-mode java-mode objc-mode perl-mode tcl-mode)
169 "*List of language major modes which define things with brace delimiters.") 174 "*List of language major modes which define things with brace delimiters."
170 175 :type '(repeat (symbol :tag "Mode" symbol))
171 (defvar id-select-markup-modes 176 :group 'id-select)
177
178 (defcustom id-select-markup-modes
172 '(html-mode sgml-mode) 179 '(html-mode sgml-mode)
173 "*List of markup language modes that use SGML-style <tag> </tag> pairs.") 180 "*List of markup language modes that use SGML-style <tag> </tag> pairs."
174 181 :type '(repeat (symbol :tag "Mode"))
175 (defvar id-select-text-modes 182 :group 'id-select)
183
184 (defcustom id-select-text-modes
176 '(fundamental-mode kotl-mode indented-text-mode Info-mode outline-mode text-mode) 185 '(fundamental-mode kotl-mode indented-text-mode Info-mode outline-mode text-mode)
177 "*List of textual modes where paragraphs may be outdented or indented.") 186 "*List of textual modes where paragraphs may be outdented or indented."
178 187 :type '(repeat (symbol :tag "Mode"))
179 (defvar id-select-indent-modes 188 :group 'id-select)
189
190 (defcustom id-select-indent-modes
180 (append '(asm-mode csh-mode eiffel-mode ksh-mode miranda-mode python-mode 191 (append '(asm-mode csh-mode eiffel-mode ksh-mode miranda-mode python-mode
181 pascal-mode sather-mode) 192 pascal-mode sather-mode)
182 id-select-text-modes) 193 id-select-text-modes)
183 "*List of language major modes which use mostly indentation to define syntactic structure.") 194 "*List of language major modes which use mostly indentation to define syntactic structure."
195 :type '(repeat (symbol :tag "Mode"))
196 :group 'id-select)
184 197
185 (defvar id-select-indent-non-end-regexp-alist 198 (defvar id-select-indent-non-end-regexp-alist
186 '((csh-mode "\\(\\|then\\|elsif\\|else\\)[ \t]*$") 199 '((csh-mode "\\(\\|then\\|elsif\\|else\\)[ \t]*$")
187 (eiffel-mode "\\(\\|then\\|else if\\|else\\)[ \t]*$") 200 (eiffel-mode "\\(\\|then\\|else if\\|else\\)[ \t]*$")
188 (ksh-mode "\\(\\|then\\|elif\\|else\\)[ \t]*$") 201 (ksh-mode "\\(\\|then\\|elif\\|else\\)[ \t]*$")
212 (Info-mode "[ \t]*$") 225 (Info-mode "[ \t]*$")
213 (text-mode "[ \t]*$") 226 (text-mode "[ \t]*$")
214 ) 227 )
215 "List of (major-mode . terminator-line-regexp) elements used to include a final line when marking indented code.") 228 "List of (major-mode . terminator-line-regexp) elements used to include a final line when marking indented code.")
216 229
217 (defvar id-select-char-p t 230 (defcustom id-select-char-p t
218 "*If t, return single character boundaries when all else fails.") 231 "*If t, return single character boundaries when all else fails."
219 232 :type 'boolean
220 (defvar id-select-display-type t 233 :group 'id-select)
221 "*If t, display the thing selected with each mouse click.") 234
222 235 (defcustom id-select-display-type t
223 (defvar id-select-whitespace t 236 "*If t, display the thing selected with each mouse click."
224 "*If t, groups of whitespace are considered as things.") 237 :type 'boolean
238 :group 'id-select)
239
240 (defcustom id-select-whitespace t
241 "*If t, groups of whitespace are considered as things."
242 :type 'boolean
243 :group 'id-select)
225 244
226 (if (string-match "XEmacs" emacs-version) 245 (if (string-match "XEmacs" emacs-version)
227 (add-hook 'mouse-track-click-hook 'id-select-double-click-hook) 246 (add-hook 'mouse-track-click-hook 'id-select-double-click-hook)
228 (if (string-match "^19\\." emacs-version) 247 (if (string-match "^19\\." emacs-version)
229 (progn (transient-mark-mode 1) 248 (progn (transient-mark-mode 1)
1227 The function `id-select-set-region' updates and returns it.") 1246 The function `id-select-set-region' updates and returns it.")
1228 1247
1229 (defvar id-select-old-region (cons 'nil 'nil) 1248 (defvar id-select-old-region (cons 'nil 'nil)
1230 "Cons cell that contains a region (<beginning> . <end>).") 1249 "Cons cell that contains a region (<beginning> . <end>).")
1231 1250
1232 (defvar id-select-syntax-alist 1251 (defcustom id-select-syntax-alist
1233 '((?w id-select-word) 1252 '((?w id-select-word)
1234 (?_ id-select-symbol) 1253 (?_ id-select-symbol)
1235 (?\" id-select-string) 1254 (?\" id-select-string)
1236 (?\( id-select-sexp-start) 1255 (?\( id-select-sexp-start)
1237 (?\$ id-select-sexp-start) 1256 (?\$ id-select-sexp-start)
1241 (?< id-select-comment) 1260 (?< id-select-comment)
1242 (?. id-select-punctuation)) 1261 (?. id-select-punctuation))
1243 "*List of pairs of the form (SYNTAX-CHAR FUNCTION) used by the function `id-select-syntactical-region'. 1262 "*List of pairs of the form (SYNTAX-CHAR FUNCTION) used by the function `id-select-syntactical-region'.
1244 Each FUNCTION takes a single position argument and returns a region 1263 Each FUNCTION takes a single position argument and returns a region
1245 (start . end) delineating the boundaries of the thing at that position. 1264 (start . end) delineating the boundaries of the thing at that position.
1246 Ordering of entries is largely irrelevant to any code that uses this list.") 1265 Ordering of entries is largely irrelevant to any code that uses this list."
1266 :type '(repeat (list (sexp :tag "Syntax-Char" function)))
1267 :group 'id-select)
1247 1268
1248 1269
1249 (provide 'id-select) 1270 (provide 'id-select)