[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/re-builder.el
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/re-builder.el |
Date: |
Sat, 23 Jul 2005 22:29:15 -0400 |
Index: emacs/lisp/emacs-lisp/re-builder.el
diff -c emacs/lisp/emacs-lisp/re-builder.el:1.26
emacs/lisp/emacs-lisp/re-builder.el:1.27
*** emacs/lisp/emacs-lisp/re-builder.el:1.26 Thu Jul 21 09:10:49 2005
--- emacs/lisp/emacs-lisp/re-builder.el Sun Jul 24 02:29:14 2005
***************
*** 299,318 ****
(add-hook 'kill-buffer-hook 'reb-kill-buffer)
(reb-auto-update nil nil nil))
-
- ;; Handy macro for doing things in other windows
- (defmacro reb-with-current-window (window &rest body)
- "With WINDOW selected evaluate BODY forms and reselect previous window."
-
- (let ((oldwindow (make-symbol "*oldwindow*")))
- `(let ((,oldwindow (selected-window)))
- (select-window ,window)
- (unwind-protect
- (progn
- ,@body)
- (select-window ,oldwindow)))))
- (put 'reb-with-current-window 'lisp-indent-function 0)
-
(defun reb-color-display-p ()
"Return t if display is capable of displaying colors."
(eq 'color
--- 299,304 ----
***************
*** 330,335 ****
--- 316,330 ----
"Return binding for SYMBOL in the RE Builder target buffer."
`(with-current-buffer reb-target-buffer ,symbol))
+ (defun reb-initialize-buffer ()
+ "Initialize the current buffer as a RE Builder buffer."
+ (erase-buffer)
+ (reb-insert-regexp)
+ (goto-char (+ 2 (point-min)))
+ (cond ((reb-lisp-syntax-p)
+ (reb-lisp-mode))
+ (t (reb-mode))))
+
;;; This is to help people find this in Apropos.
;;;###autoload
(defalias 'regexp-builder 're-builder)
***************
*** 349,361 ****
reb-window-config (current-window-configuration))
(select-window (split-window (selected-window) (- (window-height) 4)))
(switch-to-buffer (get-buffer-create reb-buffer))
! (erase-buffer)
! (reb-insert-regexp)
! (goto-char (+ 2 (point-min)))
! (cond
! ((reb-lisp-syntax-p)
! (reb-lisp-mode))
! (t (reb-mode)))))
(defun reb-change-target-buffer (buf)
"Change the target buffer and display it in the target window."
--- 344,350 ----
reb-window-config (current-window-configuration))
(select-window (split-window (selected-window) (- (window-height) 4)))
(switch-to-buffer (get-buffer-create reb-buffer))
! (reb-initialize-buffer)))
(defun reb-change-target-buffer (buf)
"Change the target buffer and display it in the target window."
***************
*** 393,400 ****
(interactive)
(reb-assert-buffer-in-window)
! (reb-with-current-window
! reb-target-window
(if (not (re-search-forward reb-regexp (point-max) t))
(message "No more matches.")
(reb-show-subexp
--- 382,388 ----
(interactive)
(reb-assert-buffer-in-window)
! (with-selected-window reb-target-window
(if (not (re-search-forward reb-regexp (point-max) t))
(message "No more matches.")
(reb-show-subexp
***************
*** 406,418 ****
(interactive)
(reb-assert-buffer-in-window)
! (reb-with-current-window reb-target-window
! (goto-char (1- (point)))
! (if (not (re-search-backward reb-regexp (point-min) t))
! (message "No more matches.")
! (reb-show-subexp
! (or (and reb-subexp-mode reb-subexp-displayed) 0)
! t))))
(defun reb-toggle-case ()
"Toggle case sensitivity of searches for RE Builder target buffer."
--- 394,408 ----
(interactive)
(reb-assert-buffer-in-window)
! (with-selected-window reb-target-window
! (let ((p (point)))
! (goto-char (1- p))
! (if (re-search-backward reb-regexp (point-min) t)
! (reb-show-subexp
! (or (and reb-subexp-mode reb-subexp-displayed) 0)
! t)
! (goto-char p)
! (message "No more matches.")))))
(defun reb-toggle-case ()
"Toggle case sensitivity of searches for RE Builder target buffer."
***************
*** 449,455 ****
the match should already be marked by an overlay.
On other displays jump to the beginning and the end of it.
If the optional PAUSE is non-nil then pause at the end in any case."
! (reb-with-current-window reb-target-window
(if (not (reb-color-display-p))
(progn (goto-char (match-beginning subexp))
(sit-for reb-blink-delay)))
--- 439,445 ----
the match should already be marked by an overlay.
On other displays jump to the beginning and the end of it.
If the optional PAUSE is non-nil then pause at the end in any case."
! (with-selected-window reb-target-window
(if (not (reb-color-display-p))
(progn (goto-char (match-beginning subexp))
(sit-for reb-blink-delay)))
***************
*** 479,492 ****
(if (memq syntax '(read string lisp-re sregex rx))
(let ((buffer (get-buffer reb-buffer)))
(setq reb-re-syntax syntax)
! (if buffer
! (with-current-buffer buffer
! (erase-buffer)
! (reb-insert-regexp)
! (goto-char (+ 2 (point-min)))
! (cond ((reb-lisp-syntax-p)
! (reb-lisp-mode))
! (t (reb-mode))))))
(error "Invalid syntax: %s" syntax)))
--- 469,477 ----
(if (memq syntax '(read string lisp-re sregex rx))
(let ((buffer (get-buffer reb-buffer)))
(setq reb-re-syntax syntax)
! (when buffer
! (with-current-buffer buffer
! (reb-initialize-buffer))))
(error "Invalid syntax: %s" syntax)))