From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Exit status inserted in shell command output buffer Date: 25 Feb 2002 14:58:30 +0100 Message-ID: <5xofidvf21.fsf@kfs2.cua.dk> References: <5xsn7pvgra.fsf@kfs2.cua.dk> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: quimby2.netfonds.no 1014645799 11164 195.204.10.66 (25 Feb 2002 14:03:19 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 25 Feb 2002 14:03:19 GMT Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16fLio-0002ty-00 for ; Mon, 25 Feb 2002 15:03:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16fLft-0002p1-00; Mon, 25 Feb 2002 09:00:17 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.33 #1 (Debian)) id 16fLd6-0002fk-00 for ; Mon, 25 Feb 2002 08:57:24 -0500 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id 0AA4A7C035 for ; Mon, 25 Feb 2002 13:57:23 +0000 (GMT) Original-To: emacs-devel@gnu.org In-Reply-To: <5xsn7pvgra.fsf@kfs2.cua.dk> Original-Lines: 66 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:1525 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1525 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 http://www.cua.dk _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel