aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Stephani2020-04-12 19:04:11 +0200
committerPhilipp Stephani2020-04-12 19:04:11 +0200
commit42306747d8dece897805e89c36c3741bfb8d5e7c (patch)
tree0181f51f2985593c4db442a284db582fb9eca554 /src
parent900947fbe8b202ce2ae15e87ef377ca27da73ec9 (diff)
downloademacs-42306747d8dece897805e89c36c3741bfb8d5e7c.tar.gz
emacs-42306747d8dece897805e89c36c3741bfb8d5e7c.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 8883415f3f5..65c858393a9 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
1099 } 1099 }
1100 1100
1101 if (nargs > 3 && !NILP (args[3])) 1101 if (nargs > 3 && !NILP (args[3]))
1102 Fdelete_region (start, end); 1102 {
1103 if (NILP (start))
1104 {
1105 /* No need to save restrictions since we delete everything
1106 anyway. */
1107 Fwiden ();
1108 del_range (BEG, Z);
1109 }
1110 else
1111 Fdelete_region (start, end);
1112 }
1103 1113
1104 if (nargs > 3) 1114 if (nargs > 3)
1105 { 1115 {