summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-11-20 18:20:56 +0000
committerEli Zaretskii <eliz@gnu.org>2001-11-20 18:20:56 +0000
commitf83576d9d01eadb299278537bc9733ce1b48c549 (patch)
tree5009d732313c8be24fc6a00eb1a7cf875e03c415
parent49854b087cee56dd5ae98abadffdb76f042e90fd (diff)
downloademacs-f83576d9d01eadb299278537bc9733ce1b48c549.tar.gz
(reb-change-target-buffer): New function.
(top-level): Bind it to C-c C-b.
-rw-r--r--lisp/emacs-lisp/re-builder.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index aeeca8ffddd..350a569a456 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -1,6 +1,6 @@
;;; re-builder.el --- building Regexps with visual feedback
-;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
;; Author: Detlev Zundel <dzu@gnu.org>
;; Keywords: matching, lisp, tools
@@ -44,6 +44,11 @@
;; you want to know the reason why RE Builder considers it as invalid
;; call `reb-force-update' ("\C-c\C-u") which should reveal the error.
+;; The target buffer can be changed with `reb-change-target-buffer'
+;; ("\C-c\C-b"). Changing the target buffer automatically removes
+;; the overlays from the old buffer and displays the new one in the
+;; target window.
+
;; The `re-builder' keeps the focus while updating the matches in the
;; target buffer so corrections are easy to incorporate. If you are
;; satisfied with the result you can paste the RE to the kill-ring
@@ -224,6 +229,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
(define-key reb-mode-map "\C-c\C-r" 'reb-prev-match)
(define-key reb-mode-map "\C-c\C-i" 'reb-change-syntax)
(define-key reb-mode-map "\C-c\C-e" 'reb-enter-subexp-mode)
+ (define-key reb-mode-map "\C-c\C-b" 'reb-change-target-buffer)
(define-key reb-mode-map "\C-c\C-u" 'reb-force-update)))
(define-derived-mode reb-mode nil "RE Builder"
@@ -322,6 +328,18 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
(reb-lisp-mode))
(t (reb-mode))))
+(defun reb-change-target-buffer (buf)
+ "Change the target buffer and display it in the target window."
+ (interactive "bSet target buffer to: ")
+
+ (let ((buffer (get-buffer buf)))
+ (if (not buffer)
+ (error "No such buffer")
+ (reb-delete-overlays)
+ (setq reb-target-buffer buffer)
+ (reb-do-update
+ (if reb-subexp-mode reb-subexp-displayed nil))
+ (reb-update-modestring))))
(defun reb-force-update ()
"Forces an update in the RE Builder target window without a match limit."