[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [21.5] call-process-region problem
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Wed, 26 Nov 2003 10:03:50 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 06126
- References: <email@example.com>
Could you please clarify whether it is a bug or specification?
If it is not a bug, it is necessary to add notes, isn't it?
>>>>> In <firstname.lastname@example.org> Katsumi Yamaoka wrote:
> 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:
> (insert "Hello World")
> (goto-char 2)
> (call-process-region (point-min) (point-max) "cat" t t)
> => ""
> Such an accident does not happen in Emacs or XEmacs 21.4.
>>>>> In <email@example.com> Katsumi Yamaoka wrote:
--- code-process.el~ 2002-11-10 22:07:29 +0000
+++ code-process.el 2003-11-21 10:14:54 +0000
@@ -171,15 +171,13 @@
;; 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))))
- (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 deletep
+ (goto-char end))
+ (apply #'call-process program (list (current-buffer) start end)
+ buffer displayp args)
+ (if deletep
+ (delete-region start end))))
(defun start-process (name buffer program &rest program-args)
"Start a program in a subprocess. Return the process object for it.