[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4230674: Fix error in 'call-process-region' when START is nil (Bu
From: |
Philipp Stephani |
Subject: |
master 4230674: Fix error in 'call-process-region' when START is nil (Bug#40576) |
Date: |
Sun, 12 Apr 2020 13:06:24 -0400 (EDT) |
branch: master
commit 42306747d8dece897805e89c36c3741bfb8d5e7c
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
Fix error in 'call-process-region' when START is nil (Bug#40576)
* src/callproc.c (Fcall_process_region): Fix behavior when START is
nil and DELETE is non-nil.
* test/src/callproc-tests.el
(call-process-region-entire-buffer-with-delete): New unit test.
---
src/callproc.c | 12 +++++++++++-
test/src/callproc-tests.el | 10 ++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/callproc.c b/src/callproc.c
index 8883415..65c8583 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1099,7 +1099,17 @@ usage: (call-process-region START END PROGRAM &optional
DELETE BUFFER DISPLAY &r
}
if (nargs > 3 && !NILP (args[3]))
- Fdelete_region (start, end);
+ {
+ if (NILP (start))
+ {
+ /* No need to save restrictions since we delete everything
+ anyway. */
+ Fwiden ();
+ del_range (BEG, Z);
+ }
+ else
+ Fdelete_region (start, end);
+ }
if (nargs > 3)
{
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el
index bf7d47b..1617d5e 100644
--- a/test/src/callproc-tests.el
+++ b/test/src/callproc-tests.el
@@ -66,4 +66,14 @@
(error :got-error))))
(should have-called-debugger)))
+(ert-deftest call-process-region-entire-buffer-with-delete ()
+ "Check that Bug#40576 is fixed."
+ (let ((emacs (expand-file-name invocation-name invocation-directory)))
+ (skip-unless (file-executable-p emacs))
+ (with-temp-buffer
+ (insert "Buffer contents\n")
+ (should
+ (eq (call-process-region nil nil emacs :delete nil nil "--version") 0))
+ (should (eq (buffer-size) 0)))))
+
;;; callproc-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 4230674: Fix error in 'call-process-region' when START is nil (Bug#40576),
Philipp Stephani <=