diff options
| author | Eli Zaretskii | 2001-11-20 18:20:56 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-11-20 18:20:56 +0000 |
| commit | 84c7e2dc6143b49707fa9481f0626feee1962a47 (patch) | |
| tree | 7e9c879474de3e1d8a9cf7546b23eab13eecbda9 | |
| parent | 706e6a5286c79831d7814691ffc1f3685c70a79b (diff) | |
| download | emacs-84c7e2dc6143b49707fa9481f0626feee1962a47.tar.gz emacs-84c7e2dc6143b49707fa9481f0626feee1962a47.zip | |
(reb-change-target-buffer): New function.
(top-level): Bind it to C-c C-b.
| -rw-r--r-- | lisp/emacs-lisp/re-builder.el | 20 |
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 @@ | |||
| 1 | ;;; re-builder.el --- building Regexps with visual feedback | 1 | ;;; re-builder.el --- building Regexps with visual feedback |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Detlev Zundel <dzu@gnu.org> | 5 | ;; Author: Detlev Zundel <dzu@gnu.org> |
| 6 | ;; Keywords: matching, lisp, tools | 6 | ;; Keywords: matching, lisp, tools |
| @@ -44,6 +44,11 @@ | |||
| 44 | ;; you want to know the reason why RE Builder considers it as invalid | 44 | ;; 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. | 45 | ;; call `reb-force-update' ("\C-c\C-u") which should reveal the error. |
| 46 | 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 | |||
| 47 | ;; The `re-builder' keeps the focus while updating the matches in the | 52 | ;; The `re-builder' keeps the focus while updating the matches in the |
| 48 | ;; target buffer so corrections are easy to incorporate. If you are | 53 | ;; target buffer so corrections are easy to incorporate. If you are |
| 49 | ;; satisfied with the result you can paste the RE to the kill-ring | 54 | ;; 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'.") | |||
| 224 | (define-key reb-mode-map "\C-c\C-r" 'reb-prev-match) | 229 | (define-key reb-mode-map "\C-c\C-r" 'reb-prev-match) |
| 225 | (define-key reb-mode-map "\C-c\C-i" 'reb-change-syntax) | 230 | (define-key reb-mode-map "\C-c\C-i" 'reb-change-syntax) |
| 226 | (define-key reb-mode-map "\C-c\C-e" 'reb-enter-subexp-mode) | 231 | (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) | ||
| 227 | (define-key reb-mode-map "\C-c\C-u" 'reb-force-update))) | 233 | (define-key reb-mode-map "\C-c\C-u" 'reb-force-update))) |
| 228 | 234 | ||
| 229 | (define-derived-mode reb-mode nil "RE Builder" | 235 | (define-derived-mode reb-mode nil "RE Builder" |
| @@ -322,6 +328,18 @@ Except for Lisp syntax this is the same as `reb-regexp'.") | |||
| 322 | (reb-lisp-mode)) | 328 | (reb-lisp-mode)) |
| 323 | (t (reb-mode)))) | 329 | (t (reb-mode)))) |
| 324 | 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)))) | ||
| 325 | 343 | ||
| 326 | (defun reb-force-update () | 344 | (defun reb-force-update () |
| 327 | "Forces an update in the RE Builder target window without a match limit." | 345 | "Forces an update in the RE Builder target window without a match limit." |