Mercurial > emacs
annotate lisp/emacs-lisp/re-builder.el @ 67661:6f662b71d7cf
(all): Add user options in macterm.c. Add test for
Mac-related built-ins. Fix test for GTK-related built-ins.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Mon, 19 Dec 2005 08:28:55 +0000 |
parents | 5b1a238fcbb4 |
children | 067115a6e738 2d92f5c9d6ae |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36012
diff
changeset
|
1 ;;; re-builder.el --- building Regexps with visual feedback |
28077 | 2 |
64751
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64624
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, |
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64624
diff
changeset
|
4 ;; 2005 Free Software Foundation, Inc. |
28077 | 5 |
6 ;; Author: Detlev Zundel <dzu@gnu.org> | |
7 ;; Keywords: matching, lisp, tools | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
28077 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; When I have to come up with regular expressions that are more | |
29 ;; complex than simple string matchers, especially if they contain sub | |
30 ;; expressions, I find myself spending quite some time in the | |
31 ;; `development cycle'. `re-builder' aims to shorten this time span | |
32 ;; so I can get on with the more interesting bits. | |
33 | |
34 ;; With it you can have immediate visual feedback about how well the | |
35 ;; regexp behaves to your expectations on the intended data. | |
36 | |
37 ;; When called up `re-builder' attaches itself to the current buffer | |
38 ;; which becomes its target buffer, where all the matching is done. | |
39 ;; The active window is split so you have a view on the data while | |
40 ;; authoring the RE. If the edited expression is valid the matches in | |
41 ;; the target buffer are marked automatically with colored overlays | |
42 ;; (for non-color displays see below) giving you feedback over the | |
43 ;; extents of the matched (sub) expressions. The (non-)validity is | |
44 ;; shown only in the modeline without throwing the errors at you. If | |
45 ;; you want to know the reason why RE Builder considers it as invalid | |
46 ;; call `reb-force-update' ("\C-c\C-u") which should reveal the error. | |
47 | |
41313
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
48 ;; The target buffer can be changed with `reb-change-target-buffer' |
56698
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
49 ;; ("\C-c\C-b"). Changing the target buffer automatically removes |
41313
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
50 ;; the overlays from the old buffer and displays the new one in the |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
51 ;; target window. |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
52 |
28077 | 53 ;; The `re-builder' keeps the focus while updating the matches in the |
54 ;; target buffer so corrections are easy to incorporate. If you are | |
55 ;; satisfied with the result you can paste the RE to the kill-ring | |
56 ;; with `reb-copy' ("\C-c\C-w"), quit the `re-builder' ("\C-c\C-q") | |
57 ;; and use it wherever you need it. | |
58 | |
59 ;; As the automatic updates can take some time on large buffers, they | |
60 ;; can be limited by `reb-auto-match-limit' so that they should not | |
61 ;; have a negative impact on the editing. Setting it to nil makes | |
62 ;; even the auto updates go all the way. Forcing an update overrides | |
63 ;; this limit allowing an easy way to see all matches. | |
64 | |
59396
1c58b91ca0df
Update copyright. Update commentary to mention rx syntax support.
John Paul Wallington <jpw@pobox.com>
parents:
56698
diff
changeset
|
65 ;; Currently `re-builder' understands five different forms of input, |
1c58b91ca0df
Update copyright. Update commentary to mention rx syntax support.
John Paul Wallington <jpw@pobox.com>
parents:
56698
diff
changeset
|
66 ;; namely `read', `string', `rx', `sregex' and `lisp-re' syntax. Read |
28077 | 67 ;; syntax and string syntax are both delimited by `"'s and behave |
68 ;; according to their name. With the `string' syntax there's no need | |
69 ;; to escape the backslashes and double quotes simplifying the editing | |
59396
1c58b91ca0df
Update copyright. Update commentary to mention rx syntax support.
John Paul Wallington <jpw@pobox.com>
parents:
56698
diff
changeset
|
70 ;; somewhat. The other three allow editing of symbolic regular |
28077 | 71 ;; expressions supported by the packages of the same name. (`lisp-re' |
72 ;; is a package by me and its support may go away as it is nearly the | |
73 ;; same as the `sregex' package in Emacs) | |
74 | |
75 ;; Editing symbolic expressions is done through a major mode derived | |
76 ;; from `emacs-lisp-mode' so you'll get all the good stuff like | |
77 ;; automatic indentation and font-locking etc. | |
78 | |
79 ;; When editing a symbolic regular expression, only the first | |
80 ;; expression in the RE Builder buffer is considered, which helps | |
81 ;; limiting the extent of the expression like the `"'s do for the text | |
82 ;; modes. For the `sregex' syntax the function `sregex' is applied to | |
83 ;; the evaluated expression read. So you can use quoted arguments | |
84 ;; with something like '("findme") or you can construct arguments to | |
85 ;; your hearts delight with a valid ELisp expression. (The compiled | |
86 ;; string form will be copied by `reb-copy') If you want to take | |
87 ;; a glance at the corresponding string you can temporarily change the | |
88 ;; input syntax. | |
89 | |
90 ;; Changing the input syntax is transparent (for the obvious exception | |
91 ;; non-symbolic -> symbolic) so you can change your mind as often as | |
92 ;; you like. | |
93 | |
94 ;; There is also a shortcut function for toggling the | |
95 ;; `case-fold-search' variable in the target buffer with an immediate | |
96 ;; update. | |
97 | |
98 | |
99 ;; Q: But what if my display cannot show colored overlays? | |
100 ;; A: Then the cursor will flash around the matched text making it stand | |
101 ;; out. | |
102 | |
103 ;; Q: But how can I then make out the sub-expressions? | |
104 ;; A: Thats where the `sub-expression mode' comes in. In it only the | |
105 ;; digit keys are assigned to perform an update that will flash the | |
106 ;; corresponding subexp only. | |
107 | |
108 | |
109 ;;; Code: | |
110 | |
111 ;; On XEmacs, load the overlay compatibility library | |
112 (if (not (fboundp 'make-overlay)) | |
113 (require 'overlay)) | |
114 | |
115 ;; User costomizable variables | |
116 (defgroup re-builder nil | |
117 "Options for the RE Builder." | |
118 :group 'lisp | |
119 :prefix "reb-") | |
120 | |
121 (defcustom reb-blink-delay 0.5 | |
122 "*Seconds to blink cursor for next/previous match in RE Builder." | |
123 :group 're-builder | |
124 :type 'number) | |
125 | |
126 (defcustom reb-mode-hook nil | |
127 "*Hooks to run on entering RE Builder mode." | |
128 :group 're-builder | |
129 :type 'hook) | |
130 | |
131 (defcustom reb-re-syntax 'read | |
132 "*Syntax for the REs in the RE Builder. | |
28097
5d7390b72a44
(reb-re-syntax): Fix typo in `:type'. Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
28077
diff
changeset
|
133 Can either be `read', `string', `sregex' or `lisp-re'." |
28077 | 134 :group 're-builder |
135 :type '(choice (const :tag "Read syntax" read) | |
136 (const :tag "String syntax" string) | |
137 (const :tag "`sregex' syntax" sregex) | |
138 (const :tag "`lisp-re' syntax" lisp-re) | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
139 (const :tag "`rx' syntax" rx) |
28097
5d7390b72a44
(reb-re-syntax): Fix typo in `:type'. Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
28077
diff
changeset
|
140 (value: string))) |
28077 | 141 |
142 (defcustom reb-auto-match-limit 200 | |
143 "*Positive integer limiting the matches for RE Builder auto updates. | |
144 Set it to nil if you don't want limits here." | |
145 :group 're-builder | |
146 :type '(restricted-sexp :match-alternatives | |
147 (integerp 'nil))) | |
148 | |
149 | |
150 (defface reb-match-0 | |
41371 | 151 '((((class color) (background light)) |
152 :background "lightblue") | |
153 (((class color) (background dark)) | |
154 :background "steelblue4") | |
155 (t | |
156 :inverse-video t)) | |
28077 | 157 "Used for displaying the whole match." |
158 :group 're-builder) | |
159 | |
160 (defface reb-match-1 | |
41371 | 161 '((((class color) (background light)) |
162 :background "aquamarine") | |
163 (((class color) (background dark)) | |
164 :background "blue3") | |
165 (t | |
166 :inverse-video t)) | |
28077 | 167 "Used for displaying the first matching subexpression." |
168 :group 're-builder) | |
169 | |
170 (defface reb-match-2 | |
41371 | 171 '((((class color) (background light)) |
172 :background "springgreen") | |
173 (((class color) (background dark)) | |
174 :background "chartreuse4") | |
175 (t | |
176 :inverse-video t)) | |
28077 | 177 "Used for displaying the second matching subexpression." |
178 :group 're-builder) | |
179 | |
180 (defface reb-match-3 | |
61394
31aa9a390538
* mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60282
diff
changeset
|
181 '((((min-colors 88) (class color) (background light)) |
31aa9a390538
* mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60282
diff
changeset
|
182 :background "yellow1") |
31aa9a390538
* mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents:
60282
diff
changeset
|
183 (((class color) (background light)) |
41371 | 184 :background "yellow") |
185 (((class color) (background dark)) | |
186 :background "sienna4") | |
187 (t | |
188 :inverse-video t)) | |
28077 | 189 "Used for displaying the third matching subexpression." |
190 :group 're-builder) | |
191 | |
192 ;; Internal variables below | |
193 (defvar reb-mode nil | |
194 "Enables the RE Builder minor mode.") | |
195 | |
196 (defvar reb-target-buffer nil | |
197 "Buffer to which the RE is applied to.") | |
198 | |
199 (defvar reb-target-window nil | |
200 "Window to which the RE is applied to.") | |
201 | |
202 (defvar reb-regexp nil | |
203 "Last regexp used by RE Builder.") | |
204 | |
205 (defvar reb-regexp-src nil | |
206 "Last regexp used by RE Builder before processing it. | |
207 Except for Lisp syntax this is the same as `reb-regexp'.") | |
208 | |
209 (defvar reb-overlays nil | |
210 "List of overlays of the RE Builder.") | |
211 | |
212 (defvar reb-window-config nil | |
213 "Old window configuration.") | |
214 | |
215 (defvar reb-subexp-mode nil | |
216 "Indicates whether sub-exp mode is active.") | |
217 | |
218 (defvar reb-subexp-displayed nil | |
219 "Indicates which sub-exp is active.") | |
220 | |
221 (defvar reb-mode-string "" | |
222 "String in mode line for additional info.") | |
223 | |
224 (defvar reb-valid-string "" | |
225 "String in mode line showing validity of RE.") | |
226 | |
227 (make-variable-buffer-local 'reb-overlays) | |
228 (make-variable-buffer-local 'reb-regexp) | |
229 (make-variable-buffer-local 'reb-regexp-src) | |
230 | |
231 (defconst reb-buffer "*RE-Builder*" | |
232 "Buffer to use for the RE Builder.") | |
233 | |
234 ;; Define the local "\C-c" keymap | |
56698
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
235 (defvar reb-mode-map |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
236 (let ((map (make-sparse-keymap))) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
237 (define-key map "\C-c\C-c" 'reb-toggle-case) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
238 (define-key map "\C-c\C-q" 'reb-quit) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
239 (define-key map "\C-c\C-w" 'reb-copy) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
240 (define-key map "\C-c\C-s" 'reb-next-match) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
241 (define-key map "\C-c\C-r" 'reb-prev-match) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
242 (define-key map "\C-c\C-i" 'reb-change-syntax) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
243 (define-key map "\C-c\C-e" 'reb-enter-subexp-mode) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
244 (define-key map "\C-c\C-b" 'reb-change-target-buffer) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
245 (define-key map "\C-c\C-u" 'reb-force-update) |
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
246 map) |
28077 | 247 "Keymap used by the RE Builder.") |
248 | |
41333
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
249 (defun reb-mode () |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
250 "Major mode for interactively building Regular Expressions. |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
251 \\{reb-mode-map}" |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
252 (interactive) |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
253 (kill-all-local-variables) |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
254 (setq major-mode 'reb-mode |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
255 mode-name "RE Builder") |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
256 (use-local-map reb-mode-map) |
fcb2aaafc8b2
(reb-mode): Don't use define-derived-mode. Call kill-all-local-variables.
Richard M. Stallman <rms@gnu.org>
parents:
41314
diff
changeset
|
257 (reb-mode-common) |
62757
0c94929d0a7d
(reb-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62402
diff
changeset
|
258 (run-mode-hooks 'reb-mode-hook)) |
28077 | 259 |
260 (define-derived-mode reb-lisp-mode | |
261 emacs-lisp-mode "RE Builder Lisp" | |
41225
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
262 "Major mode for interactively building symbolic Regular Expressions." |
28077 | 263 (cond ((eq reb-re-syntax 'lisp-re) ; Pull in packages |
264 (require 'lisp-re)) ; as needed | |
265 ((eq reb-re-syntax 'sregex) ; sregex is not autoloaded | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
266 (require 'sregex)) ; right now.. |
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
267 ((eq reb-re-syntax 'rx) ; rx-to-string is autoloaded |
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
268 (require 'rx))) ; require rx anyway |
28077 | 269 (reb-mode-common)) |
270 | |
271 ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from | |
272 ;; `emacs-lisp-mode' | |
273 (define-key reb-lisp-mode-map "\C-c" | |
274 (lookup-key reb-mode-map "\C-c")) | |
275 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48379
diff
changeset
|
276 (defvar reb-subexp-mode-map |
41225
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
277 (let ((m (make-keymap))) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
278 (suppress-keymap m) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
279 ;; Again share the "\C-c" keymap for the commands |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
280 (define-key m "\C-c" (lookup-key reb-mode-map "\C-c")) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
281 (define-key m "q" 'reb-quit-subexp-mode) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
282 (dotimes (digit 10) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
283 (define-key m (int-to-string digit) 'reb-display-subexp)) |
74219f3013c6
(reb-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
284 m) |
28077 | 285 "Keymap used by the RE Builder for the subexpression mode.") |
286 | |
287 (defun reb-mode-common () | |
288 "Setup functions common to functions `reb-mode' and `reb-mode-lisp'." | |
289 | |
290 (setq reb-mode-string "" | |
291 reb-valid-string "" | |
292 mode-line-buffer-identification | |
293 '(25 . ("%b" reb-mode-string reb-valid-string))) | |
294 (reb-update-modestring) | |
295 (make-local-variable 'after-change-functions) | |
296 (add-hook 'after-change-functions | |
297 'reb-auto-update) | |
298 ;; At least make the overlays go away if the buffer is killed | |
299 (make-local-variable 'reb-kill-buffer) | |
300 (add-hook 'kill-buffer-hook 'reb-kill-buffer) | |
301 (reb-auto-update nil nil nil)) | |
302 | |
303 (defun reb-color-display-p () | |
304 "Return t if display is capable of displaying colors." | |
305 (eq 'color | |
306 ;; emacs/xemacs compatibility | |
307 (if (fboundp 'frame-parameter) | |
308 (frame-parameter (selected-frame) 'display-type) | |
64382
c16c027014c6
(reb-cook-regexp): Avoid warning calling lre-compile-string.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
309 (if (fboundp 'frame-property) |
c16c027014c6
(reb-cook-regexp): Avoid warning calling lre-compile-string.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
310 (frame-property (selected-frame) 'display-type))))) |
28077 | 311 |
312 (defsubst reb-lisp-syntax-p () | |
313 "Return non-nil if RE Builder uses a Lisp syntax." | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
314 (memq reb-re-syntax '(lisp-re sregex rx))) |
28077 | 315 |
316 (defmacro reb-target-binding (symbol) | |
317 "Return binding for SYMBOL in the RE Builder target buffer." | |
318 `(with-current-buffer reb-target-buffer ,symbol)) | |
319 | |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
320 (defun reb-initialize-buffer () |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
321 "Initialize the current buffer as a RE Builder buffer." |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
322 (erase-buffer) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
323 (reb-insert-regexp) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
324 (goto-char (+ 2 (point-min))) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
325 (cond ((reb-lisp-syntax-p) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
326 (reb-lisp-mode)) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
327 (t (reb-mode)))) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
328 |
60282
b6fcc94c2d6a
(regexp-builder): New function.
Richard M. Stallman <rms@gnu.org>
parents:
59396
diff
changeset
|
329 ;;; This is to help people find this in Apropos. |
b6fcc94c2d6a
(regexp-builder): New function.
Richard M. Stallman <rms@gnu.org>
parents:
59396
diff
changeset
|
330 ;;;###autoload |
64557
c68bf82df188
(regexp-builder): Use `defalias' instead of faking it.
Juanma Barranquero <lekktu@gmail.com>
parents:
64382
diff
changeset
|
331 (defalias 'regexp-builder 're-builder) |
28077 | 332 |
333 ;;;###autoload | |
334 (defun re-builder () | |
60282
b6fcc94c2d6a
(regexp-builder): New function.
Richard M. Stallman <rms@gnu.org>
parents:
59396
diff
changeset
|
335 "Construct a regexp interactively." |
28077 | 336 (interactive) |
337 | |
41314
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
338 (if (and (string= (buffer-name) reb-buffer) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
339 (memq major-mode '(reb-mode reb-lisp-mode))) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
340 (message "Already in the RE Builder") |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
341 (if reb-target-buffer |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
342 (reb-delete-overlays)) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
343 (setq reb-target-buffer (current-buffer) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
344 reb-target-window (selected-window) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
345 reb-window-config (current-window-configuration)) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
346 (select-window (split-window (selected-window) (- (window-height) 4))) |
a2bce9d9c349
(re-builder): Don't re-enter RE Builder Mode.
Eli Zaretskii <eliz@gnu.org>
parents:
41313
diff
changeset
|
347 (switch-to-buffer (get-buffer-create reb-buffer)) |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
348 (reb-initialize-buffer))) |
28077 | 349 |
41313
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
350 (defun reb-change-target-buffer (buf) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
351 "Change the target buffer and display it in the target window." |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
352 (interactive "bSet target buffer to: ") |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
353 |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
354 (let ((buffer (get-buffer buf))) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
355 (if (not buffer) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
356 (error "No such buffer") |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
357 (reb-delete-overlays) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
358 (setq reb-target-buffer buffer) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
359 (reb-do-update |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
360 (if reb-subexp-mode reb-subexp-displayed nil)) |
2186cf9476ba
(reb-change-target-buffer): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
41225
diff
changeset
|
361 (reb-update-modestring)))) |
28077 | 362 |
363 (defun reb-force-update () | |
56698
7dbbaf3dc171
(reb-mode-map): Define within defvar.
John Paul Wallington <jpw@pobox.com>
parents:
56611
diff
changeset
|
364 "Force an update in the RE Builder target window without a match limit." |
28077 | 365 (interactive) |
366 | |
367 (let ((reb-auto-match-limit nil)) | |
368 (reb-update-overlays | |
369 (if reb-subexp-mode reb-subexp-displayed nil)))) | |
370 | |
371 (defun reb-quit () | |
372 "Quit the RE Builder mode." | |
373 (interactive) | |
374 | |
375 (setq reb-subexp-mode nil | |
376 reb-subexp-displayed nil) | |
377 (reb-delete-overlays) | |
378 (bury-buffer) | |
379 (set-window-configuration reb-window-config)) | |
380 | |
381 (defun reb-next-match () | |
382 "Go to next match in the RE Builder target window." | |
383 (interactive) | |
384 | |
385 (reb-assert-buffer-in-window) | |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
386 (with-selected-window reb-target-window |
28077 | 387 (if (not (re-search-forward reb-regexp (point-max) t)) |
388 (message "No more matches.") | |
389 (reb-show-subexp | |
390 (or (and reb-subexp-mode reb-subexp-displayed) 0) | |
391 t)))) | |
392 | |
393 (defun reb-prev-match () | |
394 "Go to previous match in the RE Builder target window." | |
395 (interactive) | |
396 | |
397 (reb-assert-buffer-in-window) | |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
398 (with-selected-window reb-target-window |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
399 (let ((p (point))) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
400 (goto-char (1- p)) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
401 (if (re-search-backward reb-regexp (point-min) t) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
402 (reb-show-subexp |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
403 (or (and reb-subexp-mode reb-subexp-displayed) 0) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
404 t) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
405 (goto-char p) |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
406 (message "No more matches."))))) |
28077 | 407 |
408 (defun reb-toggle-case () | |
409 "Toggle case sensitivity of searches for RE Builder target buffer." | |
410 (interactive) | |
411 | |
412 (with-current-buffer reb-target-buffer | |
413 (setq case-fold-search (not case-fold-search))) | |
414 (reb-update-modestring) | |
415 (reb-auto-update nil nil nil t)) | |
416 | |
417 (defun reb-copy () | |
418 "Copy current RE into the kill ring for later insertion." | |
419 (interactive) | |
420 | |
421 (reb-update-regexp) | |
422 (let ((re (with-output-to-string | |
423 (print (reb-target-binding reb-regexp))))) | |
424 (kill-new (substring re 1 (1- (length re)))) | |
425 (message "Regexp copied to kill-ring"))) | |
426 | |
427 ;; The subexpression mode is not electric because the number of | |
428 ;; matches should be seen rather than a prompt. | |
429 (defun reb-enter-subexp-mode () | |
430 "Enter the subexpression mode in the RE Builder." | |
431 (interactive) | |
432 (setq reb-subexp-mode t) | |
433 (reb-update-modestring) | |
434 (use-local-map reb-subexp-mode-map) | |
435 (message "`0'-`9' to display subexpressions `q' to quit subexp mode.")) | |
436 | |
437 (defun reb-show-subexp (subexp &optional pause) | |
438 "Visually show limit of subexpression SUBEXP of recent search. | |
439 On color displays this just puts point to the end of the expression as | |
440 the match should already be marked by an overlay. | |
441 On other displays jump to the beginning and the end of it. | |
442 If the optional PAUSE is non-nil then pause at the end in any case." | |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
443 (with-selected-window reb-target-window |
28077 | 444 (if (not (reb-color-display-p)) |
445 (progn (goto-char (match-beginning subexp)) | |
446 (sit-for reb-blink-delay))) | |
447 (goto-char (match-end subexp)) | |
448 (if (or (not (reb-color-display-p)) pause) | |
449 (sit-for reb-blink-delay)))) | |
450 | |
451 (defun reb-quit-subexp-mode () | |
452 "Quit the subexpression mode in the RE Builder." | |
453 (interactive) | |
454 (setq reb-subexp-mode nil | |
455 reb-subexp-displayed nil) | |
456 (reb-update-modestring) | |
457 (use-local-map reb-mode-map) | |
458 (reb-do-update)) | |
459 | |
460 (defun reb-change-syntax (&optional syntax) | |
461 "Change the syntax used by the RE Builder. | |
462 Optional argument SYNTAX must be specified if called non-interactively." | |
463 (interactive | |
464 (list (intern | |
465 (completing-read "Select syntax: " | |
466 (mapcar (lambda (el) (cons (symbol-name el) 1)) | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
467 '(read string lisp-re sregex rx)) |
28077 | 468 nil t (symbol-name reb-re-syntax))))) |
469 | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
470 (if (memq syntax '(read string lisp-re sregex rx)) |
28077 | 471 (let ((buffer (get-buffer reb-buffer))) |
472 (setq reb-re-syntax syntax) | |
64624
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
473 (when buffer |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
474 (with-current-buffer buffer |
c3a907cbd503
(reb-with-current-window): Delete.
Juanma Barranquero <lekktu@gmail.com>
parents:
64557
diff
changeset
|
475 (reb-initialize-buffer)))) |
28077 | 476 (error "Invalid syntax: %s" syntax))) |
477 | |
478 | |
479 ;; Non-interactive functions below | |
480 (defun reb-do-update (&optional subexp) | |
481 "Update matches in the RE Builder target window. | |
482 If SUBEXP is non-nil mark only the corresponding sub-expressions." | |
483 | |
484 (reb-assert-buffer-in-window) | |
485 (reb-update-regexp) | |
486 (reb-update-overlays subexp)) | |
487 | |
488 (defun reb-auto-update (beg end lenold &optional force) | |
489 "Called from `after-update-functions' to update the display. | |
55404
14a47b65c288
(reb-auto-update): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
490 BEG, END and LENOLD are passed in from the hook. |
28077 | 491 An actual update is only done if the regexp has changed or if the |
492 optional fourth argument FORCE is non-nil." | |
493 (let ((prev-valid reb-valid-string) | |
494 (new-valid | |
495 (condition-case nil | |
496 (progn | |
497 (if (or (reb-update-regexp) force) | |
498 (progn | |
499 (reb-assert-buffer-in-window) | |
500 (reb-do-update))) | |
501 "") | |
502 (error " *invalid*")))) | |
503 (setq reb-valid-string new-valid) | |
504 (force-mode-line-update) | |
505 | |
506 ;; Through the caching of the re a change invalidating the syntax | |
507 ;; for symbolic expressions will not delete the overlays so we | |
508 ;; catch it here | |
509 (if (and (reb-lisp-syntax-p) | |
510 (not (string= prev-valid new-valid)) | |
511 (string= prev-valid "")) | |
512 (reb-delete-overlays)))) | |
513 | |
514 (defun reb-delete-overlays () | |
515 "Delete all RE Builder overlays in the `reb-target-buffer' buffer." | |
516 (if (buffer-live-p reb-target-buffer) | |
517 (with-current-buffer reb-target-buffer | |
518 (mapcar 'delete-overlay reb-overlays) | |
519 (setq reb-overlays nil)))) | |
520 | |
521 (defun reb-assert-buffer-in-window () | |
522 "Assert that `reb-target-buffer' is displayed in `reb-target-window'." | |
523 | |
524 (if (not (eq reb-target-buffer (window-buffer reb-target-window))) | |
525 (set-window-buffer reb-target-window reb-target-buffer))) | |
526 | |
527 (defun reb-update-modestring () | |
528 "Update the variable `reb-mode-string' displayed in the mode line." | |
529 (setq reb-mode-string | |
530 (concat | |
531 (if reb-subexp-mode | |
35756
8a4490cbee15
(reb-update-modestring): Don't use concat for integers.
Eli Zaretskii <eliz@gnu.org>
parents:
28107
diff
changeset
|
532 (format " (subexp %s)" (or reb-subexp-displayed "-")) |
28077 | 533 "") |
534 (if (not (reb-target-binding case-fold-search)) | |
535 " Case" | |
536 ""))) | |
537 (force-mode-line-update)) | |
538 | |
539 (defun reb-display-subexp (&optional subexp) | |
540 "Highlight only subexpression SUBEXP in the RE Builder." | |
541 (interactive) | |
542 | |
543 (setq reb-subexp-displayed | |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61394
diff
changeset
|
544 (or subexp (string-to-number (format "%c" last-command-char)))) |
28077 | 545 (reb-update-modestring) |
546 (reb-do-update reb-subexp-displayed)) | |
547 | |
548 (defun reb-kill-buffer () | |
549 "When the RE Builder buffer is killed make sure no overlays stay around." | |
550 | |
551 (if (member major-mode '(reb-mode reb-lisp-mode)) | |
552 (reb-delete-overlays))) | |
553 | |
554 | |
555 ;; The next functions are the interface between the regexp and | |
556 ;; its textual representation in the RE Builder buffer. | |
557 ;; They are the only functions concerned with the actual syntax | |
558 ;; being used. | |
559 (defun reb-read-regexp () | |
560 "Read current RE." | |
561 (save-excursion | |
562 (cond ((eq reb-re-syntax 'read) | |
563 (goto-char (point-min)) | |
564 (read (current-buffer))) | |
565 ((eq reb-re-syntax 'string) | |
566 (goto-char (point-min)) | |
567 (re-search-forward "\"") | |
568 (let ((beg (point))) | |
569 (goto-char (point-max)) | |
570 (re-search-backward "\"") | |
571 (buffer-substring-no-properties beg (point)))) | |
572 ((reb-lisp-syntax-p) | |
573 (buffer-string))))) | |
574 | |
575 (defun reb-empty-regexp () | |
576 "Return empty RE for current syntax." | |
577 (cond ((reb-lisp-syntax-p) "'()") | |
578 (t ""))) | |
579 | |
580 (defun reb-insert-regexp () | |
581 "Insert current RE." | |
582 | |
583 (let ((re (or (reb-target-binding reb-regexp) | |
584 (reb-empty-regexp)))) | |
585 (cond ((eq reb-re-syntax 'read) | |
586 (print re (current-buffer))) | |
587 ((eq reb-re-syntax 'string) | |
588 (insert "\n\"" re "\"")) | |
589 ;; For the Lisp syntax we need the "source" of the regexp | |
590 ((reb-lisp-syntax-p) | |
591 (insert (or (reb-target-binding reb-regexp-src) | |
592 (reb-empty-regexp))))))) | |
593 | |
594 (defun reb-cook-regexp (re) | |
595 "Return RE after processing it according to `reb-re-syntax'." | |
596 (cond ((eq reb-re-syntax 'lisp-re) | |
64382
c16c027014c6
(reb-cook-regexp): Avoid warning calling lre-compile-string.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
597 (if (fboundp 'lre-compile-string) |
c16c027014c6
(reb-cook-regexp): Avoid warning calling lre-compile-string.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
598 (lre-compile-string (eval (car (read-from-string re)))))) |
28077 | 599 ((eq reb-re-syntax 'sregex) |
600 (apply 'sregex (eval (car (read-from-string re))))) | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
601 ((eq reb-re-syntax 'rx) |
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
602 (rx-to-string (eval (car (read-from-string re))))) |
28077 | 603 (t re))) |
604 | |
605 (defun reb-update-regexp () | |
606 "Update the regexp for the target buffer. | |
607 Return t if the (cooked) expression changed." | |
608 (let* ((re-src (reb-read-regexp)) | |
609 (re (reb-cook-regexp re-src))) | |
610 (with-current-buffer reb-target-buffer | |
611 (let ((oldre reb-regexp)) | |
612 (prog1 | |
613 (not (string= oldre re)) | |
614 (setq reb-regexp re) | |
615 ;; Only update the source re for the lisp formats | |
616 (if (reb-lisp-syntax-p) | |
617 (setq reb-regexp-src re-src))))))) | |
618 | |
619 | |
620 ;; And now the real core of the whole thing | |
621 (defun reb-count-subexps (re) | |
622 "Return number of sub-expressions in the regexp RE." | |
623 | |
624 (let ((i 0) (beg 0)) | |
625 (while (string-match "\\\\(" re beg) | |
626 (setq i (1+ i) | |
627 beg (match-end 0))) | |
628 i)) | |
629 | |
630 | |
631 (defun reb-update-overlays (&optional subexp) | |
632 "Switch to `reb-target-buffer' and mark all matches of `reb-regexp'. | |
633 If SUBEXP is non-nil mark only the corresponding sub-expressions." | |
634 | |
635 (let* ((re (reb-target-binding reb-regexp)) | |
636 (subexps (reb-count-subexps re)) | |
637 (matches 0) | |
638 (submatches 0) | |
639 firstmatch) | |
640 (save-excursion | |
641 (set-buffer reb-target-buffer) | |
642 (reb-delete-overlays) | |
643 (goto-char (point-min)) | |
644 (while (and (re-search-forward re (point-max) t) | |
645 (or (not reb-auto-match-limit) | |
646 (< matches reb-auto-match-limit))) | |
647 (if (= 0 (length (match-string 0))) | |
648 (error "Empty regular expression!")) | |
649 (let ((i 0)) | |
650 (setq matches (1+ matches)) | |
651 (while (<= i subexps) | |
652 (if (and (or (not subexp) (= subexp i)) | |
653 (match-beginning i)) | |
654 (let ((overlay (make-overlay (match-beginning i) | |
655 (match-end i))) | |
656 (face-name (format "reb-match-%d" i))) | |
657 (if (not firstmatch) | |
658 (setq firstmatch (match-data))) | |
659 (setq reb-overlays (cons overlay reb-overlays) | |
660 submatches (1+ submatches)) | |
661 (overlay-put | |
662 overlay 'face | |
663 (or (intern-soft face-name) | |
664 (error "Too many subexpressions - face `%s' not defined" | |
665 face-name ))) | |
666 (overlay-put overlay 'priority i))) | |
667 (setq i (1+ i)))))) | |
668 (let ((count (if subexp submatches matches))) | |
56611
8b14a3e64595
(reb-re-syntax): Add `rx' syntax.
John Paul Wallington <jpw@pobox.com>
parents:
56382
diff
changeset
|
669 (message "%s %smatch%s%s" |
28077 | 670 (if (= 0 count) "No" (int-to-string count)) |
671 (if subexp "subexpression " "") | |
56382
a4c0ce40be3d
(reb-update-overlays): Distinguish between one and several matches in message.
John Paul Wallington <jpw@pobox.com>
parents:
55404
diff
changeset
|
672 (if (= 1 count) "" "es") |
28077 | 673 (if (and reb-auto-match-limit |
674 (= reb-auto-match-limit count)) | |
675 " (limit reached)" ""))) | |
676 (if firstmatch | |
677 (progn (store-match-data firstmatch) | |
678 (reb-show-subexp (or subexp 0)))))) | |
679 | |
48379
6e55b7742a81
Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
41371
diff
changeset
|
680 (provide 're-builder) |
6e55b7742a81
Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
41371
diff
changeset
|
681 |
52401 | 682 ;;; arch-tag: 5c5515ac-4085-4524-a421-033f44f032e7 |
28077 | 683 ;;; re-builder.el ends here |