I don't think this is the proper solution. Either we should make the
zmacs-region be per-buffer or we should change region-active-p to only
return t when the zmacs region is in the current buffer. We don't want to
have to special-case every use of region-active-p.
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.