[PATCH] xemacs-21.5: Proposed fix for `call-process-region' bug uncovered tracking down suspected crypt++.el bug
Adrian Aichner
adrian at xemacs.org
Mon Mar 22 19:25:12 EST 2004
Greetings!
crypt++.el works fine under non-Mule XEmacs 21.4.15 with a minor
modification I made (proposed patch under discussion with crypt++.el
maintainer).
In 21.5-b16 Mule XEmacs, visisting a gpg encrypted file leads an empty
buffer!
I have tracked this down to code-process.el, which I believe is
currently broken because it does not consider insertion of process
output at an arbitrary point in buffer.
It also got the MARKER-TYPE argument for the s and e markers mixed up,
if I understand this correctly.
Here is the proposed patch which I would like to submit to your
scrutiny and better yet, your testing.
Works fine during minimal testing.
Please advise,
Adrian
xemacs-21.5 ChangeLog patch:
Diff command: cvs -q diff -U 0
Files affected: lisp/ChangeLog
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.554
diff -u -U0 -r1.554 ChangeLog
--- lisp/ChangeLog 8 Mar 2004 15:22:44 -0000 1.554
+++ lisp/ChangeLog 23 Mar 2004 00:23:15 -0000
@@ -0,0 +1,6 @@
+2004-03-23 Adrian Aichner <adrian at xemacs.org>
+
+ * code-process.el (call-process-region): Correct start and end
+ marker construction, delete regions before and after insertion
+ point.
+
xemacs-21.5 source patch:
Diff command: cvs -f -z3 -q diff -u -N
Files affected: lisp/code-process.el
Index: lisp/code-process.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/code-process.el,v
retrieving revision 1.12
diff -u -r1.12 code-process.el
--- lisp/code-process.el 10 Nov 2002 16:07:13 -0000 1.12
+++ lisp/code-process.el 23 Mar 2004 00:05:18 -0000
@@ -169,16 +169,22 @@
;; a temporary file was used to pass the text to call-process. Now that
;; we don't do that, we delete the text afterward; if it's being inserted
;; in the same buffer, make sure we track the insertion, and don't get
- ;; any of it in the deleted region if insertion happens at either end
- ;; of the region.
- (let ((s (and deletep (copy-marker start t)))
- (e (and deletep (copy-marker end))))
+ ;; any of it in the deleted region. We keep marker s before the
+ ;; insertion and e afterward. Finally we delete the regions before
+ ;; and after the insertion.
+ (let ((s (and deletep (copy-marker (point))))
+ (e (and deletep (copy-marker (point) t))))
(let ((retval
(apply #'call-process program (list (current-buffer) start end)
buffer displayp args)))
- ;; If start and end were the same originally, s will be beyond e now
- (if (and deletep (> e s))
- (delete-region s e))
+ ;; If start and end were the same originally, e will be beyond s now
+ (when (and deletep (> e s))
+ ;; APA: Is it always correct to honor narrowing, which affects
+ ;; (point-min) and (point-max)?
+ ;; Delete region before insertion.
+ (delete-region (point-min) s)
+ ;; Delete region after insertion.
+ (delete-region e (point-max)))
retval)))
(defun start-process (name buffer program &rest program-args)
--
Adrian Aichner
mailto:adrian at xemacs.org
http://www.xemacs.org/
More information about the XEmacs-Beta
mailing list