[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

[21.5] call-process-region problem



Hi,

Although it may be a known problem, I think it is evil that the
call-process-region function requires the point to have to be in
the beginning or the end position when the 4th arg DELETEP is t.
It simply erases the buffer's contents when that requirement is
not satisfied.  For instance:

(with-temp-buffer
  (insert "Hello World")
  (goto-char 2)
  (call-process-region (point-min) (point-max) "cat" t t)
  (buffer-string))
 => ""

Such an accident does not happen in Emacs or XEmacs 21.4.  For
this reason, emacs-w3m has not run on XEmacs 21.5 since
2002-05-28 (but it will run by the end of today).  I attach a
patch, although it may be too late.

2003-11-21  Katsumi Yamaoka  <yamaoka@jpl.org>

	* code-process.el (call-process-region): Move point to end of
	region when DELETEP is non-nil.

--- code-process.el~	2002-11-10 22:07:29 +0000
+++ code-process.el	2003-11-21 06:30:19 +0000
@@ -173,6 +173,8 @@
   ;; of the region.
   (let ((s (and deletep (copy-marker start t)))
 	(e (and deletep (copy-marker end))))
+    (if deletep
+	(goto-char end))
     (let ((retval
 	   (apply #'call-process program (list (current-buffer) start end)
 		  buffer displayp args)))