aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1998-03-19 10:30:55 +0000
committerDave Love1998-03-19 10:30:55 +0000
commit5a8dd30e2630d75ada97b2fb5df34d889693f11d (patch)
tree6799f2449452067cfd67a7fb3e027c1f8048105c
parentec9faeb4d8766e91e7e0f907c60b44f0443134fe (diff)
downloademacs-5a8dd30e2630d75ada97b2fb5df34d889693f11d.tar.gz
emacs-5a8dd30e2630d75ada97b2fb5df34d889693f11d.zip
(shell-command-on-region): Amend message to report
success or failure when no process output.
-rw-r--r--lisp/simple.el34
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 42ef85aa870..ea2e91d5a85 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,6 +1,6 @@
1;;; simple.el --- basic editing commands for Emacs 1;;; simple.el --- basic editing commands for Emacs
2 2
3;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 1997 3;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 1998
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; This file is part of GNU Emacs. 6;; This file is part of GNU Emacs.
@@ -1181,7 +1181,8 @@ If it is nil, error output is mingled with regular output."
1181 ;; replacing its entire contents. 1181 ;; replacing its entire contents.
1182 (let ((buffer (get-buffer-create 1182 (let ((buffer (get-buffer-create
1183 (or output-buffer "*Shell Command Output*"))) 1183 (or output-buffer "*Shell Command Output*")))
1184 (success nil)) 1184 (success nil)
1185 (exit-status nil))
1185 (unwind-protect 1186 (unwind-protect
1186 (if (eq buffer (current-buffer)) 1187 (if (eq buffer (current-buffer))
1187 ;; If the input is the same buffer as the output, 1188 ;; If the input is the same buffer as the output,
@@ -1190,23 +1191,25 @@ If it is nil, error output is mingled with regular output."
1190 (progn (setq buffer-read-only nil) 1191 (progn (setq buffer-read-only nil)
1191 (delete-region (max start end) (point-max)) 1192 (delete-region (max start end) (point-max))
1192 (delete-region (point-min) (min start end)) 1193 (delete-region (point-min) (min start end))
1193 (call-process-region (point-min) (point-max) 1194 (setq exit-status
1194 shell-file-name t 1195 (call-process-region (point-min) (point-max)
1195 (if error-file 1196 shell-file-name t
1196 (list t error-file) 1197 (if error-file
1197 t) 1198 (list t error-file)
1198 nil shell-command-switch command) 1199 t)
1200 nil shell-command-switch command))
1199 (setq success t)) 1201 (setq success t))
1200 ;; Clear the output buffer, then run the command with output there. 1202 ;; Clear the output buffer, then run the command with output there.
1201 (save-excursion 1203 (save-excursion
1202 (set-buffer buffer) 1204 (set-buffer buffer)
1203 (setq buffer-read-only nil) 1205 (setq buffer-read-only nil)
1204 (erase-buffer)) 1206 (erase-buffer))
1205 (call-process-region start end shell-file-name nil 1207 (setq exit-status
1206 (if error-file 1208 (call-process-region start end shell-file-name nil
1207 (list buffer error-file) 1209 (if error-file
1208 buffer) 1210 (list buffer error-file)
1209 nil shell-command-switch command) 1211 buffer)
1212 nil shell-command-switch command))
1210 (setq success t)) 1213 (setq success t))
1211 ;; Report the amount of output. 1214 ;; Report the amount of output.
1212 (let ((lines (save-excursion 1215 (let ((lines (save-excursion
@@ -1216,7 +1219,10 @@ If it is nil, error output is mingled with regular output."
1216 (count-lines (point-min) (point-max)))))) 1219 (count-lines (point-min) (point-max))))))
1217 (cond ((= lines 0) 1220 (cond ((= lines 0)
1218 (if success 1221 (if success
1219 (message "(Shell command completed with no output)")) 1222 (message "(Shell command %sed with no output)"
1223 (if (equal 0 exit-status)
1224 "succeed"
1225 "fail")))
1220 (kill-buffer buffer)) 1226 (kill-buffer buffer))
1221 ((and success (= lines 1)) 1227 ((and success (= lines 1))
1222 (message "%s" 1228 (message "%s"