unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Exit status inserted in shell command output buffer
@ 2002-02-25 13:21 Kim F. Storm
  2002-02-25 13:58 ` Kim F. Storm
  0 siblings, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2002-02-25 13:21 UTC (permalink / raw)



I don't like the new `functionality' which adds the line
"...Shell command failed with code X"
to the *Shell Command Output* buffer when a command returns
a non-zero exit status.

I think these are the relevant changes:

2002-02-20  Richard M. Stallman  <rms@gnu.org>

	* simple.el (shell-command-on-region): Display the exit status
	when a command fails.

2001-12-13  Richard M. Stallman  <rms@gnu.org>

	* simple.el
	(shell-command-on-region): If there is output an an error,
	add "...Shell command failed" to the output.


In my mind, if a command produces output, emacs shouldn't modify
(i.e. add to) the output from the command!

What do others think?

Example:

Index: shell.el
===================================================================
RCS file: /cvs/emacs/lisp/shell.el,v
retrieving revision 1.106
retrieving revision 1.107
diff -r1.106 -r1.107
318c318,319
< 	 (copy-keymap (lookup-key comint-mode-map [menu-bar completion])))
---
> 	 (cons "Complete" 
> 	       (copy-keymap (lookup-key comint-mode-map [menu-bar completion]))))
..Shell command failed with code 1


So `cvs diff' exited with code 1 because the two revisions differ.
But in my mind, the command didn't fail -- it worked just fine.
The first time I saw this, I thought that there was actually some
error causing the diff output to have been truncated....


++kfs


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exit status inserted in shell command output buffer
  2002-02-25 13:21 Exit status inserted in shell command output buffer Kim F. Storm
@ 2002-02-25 13:58 ` Kim F. Storm
  2002-02-26 20:14   ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2002-02-25 13:58 UTC (permalink / raw)



I recently wrote:
> I don't like the new `functionality' which adds the line
> "...Shell command failed with code X"
> to the *Shell Command Output* buffer when a command returns
> a non-zero exit status.
> 
> In my mind, if a command produces output, emacs shouldn't modify
> (i.e. add to) the output from the command!


The following patch places the Exit code in the mode line of the
*Shell Command Output* buffer (using the `mode-line-process' variable).

So it's shown to the users interested in such things, but don't
mess with the buffer...

What do you think? 

(The following patch was inserted here with insert-buffer without
manually having to delete the ...Shell command failed  line :-)


Index: simple.el
===================================================================
RCS file: /cvs/emacs/lisp/simple.el,v
retrieving revision 1.522
diff -c -r1.522 simple.el
*** simple.el	20 Feb 2002 22:33:01 -0000	1.522
--- simple.el	25 Feb 2002 13:56:02 -0000
***************
*** 1475,1490 ****
  					 nil shell-command-switch command)))
  	  (setq success (and exit-status (equal 0 exit-status)))
  	  ;; Report the output.
  	  (if (with-current-buffer buffer (> (point-max) (point-min)))
  	      ;; There's some output, display it
! 	      (progn
! 		(if (not success)
! 		    (with-current-buffer buffer
! 		      (save-excursion
! 			(goto-char (point-max))
! 			(insert (format "...Shell command failed with code %d"
! 					exit-status)))))
! 		(display-message-or-buffer buffer))
  	    ;; No output; error?
  	    (let ((output
  		   (if (and error-file
--- 1475,1487 ----
  					 nil shell-command-switch command)))
  	  (setq success (and exit-status (equal 0 exit-status)))
  	  ;; Report the output.
+ 	  (with-current-buffer buffer
+ 	    (setq mode-line-process 
+ 		  (if (not success)
+ 		    (concat (format " - Exit [%d]" exit-status)))))
  	  (if (with-current-buffer buffer (> (point-max) (point-min)))
  	      ;; There's some output, display it
! 	      (display-message-or-buffer buffer)
  	    ;; No output; error?
  	    (let ((output
  		   (if (and error-file


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exit status inserted in shell command output buffer
  2002-02-25 13:58 ` Kim F. Storm
@ 2002-02-26 20:14   ` Richard Stallman
  2002-02-27 18:07     ` Ehud Karni
  2002-02-27 23:37     ` Kim F. Storm
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Stallman @ 2002-02-26 20:14 UTC (permalink / raw)
  Cc: emacs-devel

    The following patch places the Exit code in the mode line of the
    *Shell Command Output* buffer (using the `mode-line-process' variable).

I won't object to this, if other people agree with you that this is better.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exit status inserted in shell command output buffer
  2002-02-26 20:14   ` Richard Stallman
@ 2002-02-27 18:07     ` Ehud Karni
  2002-02-27 23:37     ` Kim F. Storm
  1 sibling, 0 replies; 5+ messages in thread
From: Ehud Karni @ 2002-02-27 18:07 UTC (permalink / raw)
  Cc: storm, emacs-devel

On Tue, 26 Feb 2002 13:14:14 -0700 (MST), Richard Stallman <rms@gnu.org> wrote:
> 
>     The following patch places the Exit code in the mode line of the
>     *Shell Command Output* buffer (using the `mode-line-process' variable).
> 
> I won't object to this, if other people agree with you that this is better.

I think it is better. This is exactly like the "* compilation ..."
buffer mode line and the way it should be done.

Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.simonwiesel.co.il          Better  Safe  Than  Sorry

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exit status inserted in shell command output buffer
  2002-02-26 20:14   ` Richard Stallman
  2002-02-27 18:07     ` Ehud Karni
@ 2002-02-27 23:37     ` Kim F. Storm
  1 sibling, 0 replies; 5+ messages in thread
From: Kim F. Storm @ 2002-02-27 23:37 UTC (permalink / raw)
  Cc: storm, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The following patch places the Exit code in the mode line of the
>     *Shell Command Output* buffer (using the `mode-line-process' variable).
> 
> I won't object to this, if other people agree with you that this is better.

I have received a number of supporting mails and no objections, so
I've installed this.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-02-27 23:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-25 13:21 Exit status inserted in shell command output buffer Kim F. Storm
2002-02-25 13:58 ` Kim F. Storm
2002-02-26 20:14   ` Richard Stallman
2002-02-27 18:07     ` Ehud Karni
2002-02-27 23:37     ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).