1 |
;;; re-builder.el --- building Regexps with visual feedback |
;;; re-builder.el --- building Regexps with visual feedback |
2 |
|
|
3 |
;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Detlev Zundel <dzu@gnu.org> |
;; Author: Detlev Zundel <dzu@gnu.org> |
6 |
;; Keywords: matching, lisp, tools |
;; Keywords: matching, lisp, tools |
44 |
;; you want to know the reason why RE Builder considers it as invalid |
;; you want to know the reason why RE Builder considers it as invalid |
45 |
;; call `reb-force-update' ("\C-c\C-u") which should reveal the error. |
;; call `reb-force-update' ("\C-c\C-u") which should reveal the error. |
46 |
|
|
47 |
|
;; The target buffer can be changed with `reb-change-target-buffer' |
48 |
|
;; ("\C-c\C-b"). Changing the target buffer automatically removes |
49 |
|
;; the overlays from the old buffer and displays the new one in the |
50 |
|
;; target window. |
51 |
|
|
52 |
;; The `re-builder' keeps the focus while updating the matches in the |
;; The `re-builder' keeps the focus while updating the matches in the |
53 |
;; target buffer so corrections are easy to incorporate. If you are |
;; target buffer so corrections are easy to incorporate. If you are |
54 |
;; satisfied with the result you can paste the RE to the kill-ring |
;; satisfied with the result you can paste the RE to the kill-ring |
229 |
(define-key reb-mode-map "\C-c\C-r" 'reb-prev-match) |
(define-key reb-mode-map "\C-c\C-r" 'reb-prev-match) |
230 |
(define-key reb-mode-map "\C-c\C-i" 'reb-change-syntax) |
(define-key reb-mode-map "\C-c\C-i" 'reb-change-syntax) |
231 |
(define-key reb-mode-map "\C-c\C-e" 'reb-enter-subexp-mode) |
(define-key reb-mode-map "\C-c\C-e" 'reb-enter-subexp-mode) |
232 |
|
(define-key reb-mode-map "\C-c\C-b" 'reb-change-target-buffer) |
233 |
(define-key reb-mode-map "\C-c\C-u" 'reb-force-update))) |
(define-key reb-mode-map "\C-c\C-u" 'reb-force-update))) |
234 |
|
|
235 |
(define-derived-mode reb-mode nil "RE Builder" |
(define-derived-mode reb-mode nil "RE Builder" |
328 |
(reb-lisp-mode)) |
(reb-lisp-mode)) |
329 |
(t (reb-mode)))) |
(t (reb-mode)))) |
330 |
|
|
331 |
|
(defun reb-change-target-buffer (buf) |
332 |
|
"Change the target buffer and display it in the target window." |
333 |
|
(interactive "bSet target buffer to: ") |
334 |
|
|
335 |
|
(let ((buffer (get-buffer buf))) |
336 |
|
(if (not buffer) |
337 |
|
(error "No such buffer") |
338 |
|
(reb-delete-overlays) |
339 |
|
(setq reb-target-buffer buffer) |
340 |
|
(reb-do-update |
341 |
|
(if reb-subexp-mode reb-subexp-displayed nil)) |
342 |
|
(reb-update-modestring)))) |
343 |
|
|
344 |
(defun reb-force-update () |
(defun reb-force-update () |
345 |
"Forces an update in the RE Builder target window without a match limit." |
"Forces an update in the RE Builder target window without a match limit." |