Scott Evans <gse(a)antisleep.com> writes:
 On Fri, 22 Oct 2004, Steve Youngs wrote:
> * Stephen J Turnbull <stephen(a)xemacs.org> writes:
>
>   > Steve Youngs did the commit, patch was by Scott Evans.  I can't
>   > find either the patch itself
>
> <
http://list-archive.xemacs.org/xemacs-patches/200209/msg00115.html>
>
>   > or the approval on xemacs-patches,
>
> <
http://list-archive.xemacs.org/xemacs-patches/200210/msg00181.html>
>
> You really don't expect me to remember anything about it do you?
 I remember writing the code... :)  But I'm coming into this discussion
 cold since I don't subscribe to xemacs-patches.  What's up? 
Hi Scott, All!
I finally found time looking at this again.
replace.el<1.8> introduced support for regions to operate on.
dired-ediff no longer worked since then, when using zmacs-regions t.
I think I found the issue:
While Emacs' mark-active is per-buffer, XEmacs' (region-active-p) is
global.
Therefor I think the fix for XEmacs is the following:
I intend to commit after a few days of testing and waiting for feedback.
Best regards,
Adrian
lisp/ChangeLog addtion:
2005-02-20  Adrian Aichner  <adrian(a)xemacs.org>
	* replace.el (delete-non-matching-lines): Honor region only when
	active in current buffer.
	* replace.el (kill-non-matching-lines): Ditto.
	* replace.el (copy-non-matching-lines): Ditto.
	* replace.el (delete-matching-lines): Ditto.
	* replace.el (kill-matching-lines): Ditto.
	* replace.el (copy-matching-lines): Ditto.
	* replace.el (perform-replace): Ditto.
Index: replace.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/replace.el,v
retrieving revision 1.10
diff -u -u -r1.10 replace.el
--- replace.el	12 May 2003 05:12:10 -0000	1.10
+++ replace.el	20 Feb 2005 16:16:52 -0000
@@ -296,7 +296,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-non-matching-lines regexp t nil beg end))
@@ -313,7 +314,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-non-matching-lines regexp t t beg end))
@@ -330,7 +332,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-non-matching-lines regexp nil t beg end))
@@ -392,7 +395,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-matching-lines regexp t nil beg end))
@@ -409,7 +413,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-matching-lines regexp t t beg end))
@@ -426,7 +431,8 @@
   (let ((beg nil)
         (end nil)
         (count nil))
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       (setq beg (region-beginning))
       (setq end (region-end)))
     (setq count (operate-on-matching-lines regexp nil t beg end))
@@ -831,7 +837,8 @@
 	      (substitute-command-keys
 	       "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help)
"))))
     ;; If the region is active, operate on region.
-    (when (region-active-p)
+    (when (and (region-active-p)
+	       (eq (current-buffer) (zmacs-region-buffer)))
       ;; Original Per Abrahamsen's code simply narrowed the region,
       ;; thus providing a visual indication of the search boundary.
       ;; Stallman, on the other hand, handles it like this.
-- 
Adrian Aichner
 mailto:adrian@xemacs.org
 
http://www.xemacs.org/