emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple.el change


From: Richard Stallman
Subject: simple.el change
Date: Tue, 11 Dec 2001 15:53:46 -0700 (MST)

Do people see any problem with this change in M-! and M-|?
The change is that when the shell command gets an error,
the echo area says there was an error, and the output
is always displayed through its buffer.

*** simple.el.~1.512.~  Fri Dec  7 16:04:11 2001
--- simple.el   Tue Dec 11 03:25:35 2001
***************
*** 1186,1191 ****
--- 1186,1206 ----
  insert output in current buffer.  (This cannot be done asynchronously.)
  In either case, the output is inserted after point (leaving mark after it).
  
+ If the command terminates without error, but generates output,
+ and you did not specify \"insert it in the current buffer\",
+ the output can be displayed in the echo area or in its buffer.
+ If the output is short enough to display in the echo area
+ \(determined by the variable `max-mini-window-height' if
+ `resize-mini-windows' is non-nil), it is shown there.  Otherwise,
+ the buffer containing the output is displayed.
+ 
+ If there is output and an error, and you did not specify \"insert it
+ in the current buffer\", the echo area indicates the error and the
+ output is displayed in its buffer.
+ 
+ If there is no output, or if output is inserted in the current buffer,
+ then `*Shell Command Output*' is deleted.
+ 
  If the optional third argument ERROR-BUFFER is non-nil, it is a buffer
  or buffer name to which to direct the command's standard error output.
  If it is nil, error output is mingled with regular output.
***************
*** 1204,1209 ****
--- 1219,1225 ----
        (funcall handler 'shell-command command output-buffer error-buffer)
        (if (and output-buffer
               (not (or (bufferp output-buffer)  (stringp output-buffer))))
+         ;; Output goes in current buffer.
          (let ((error-file
                 (if error-buffer
                     (make-temp-file
***************
*** 1244,1249 ****
--- 1260,1266 ----
            (goto-char (prog1 (mark t)
                         (set-marker (mark-marker) (point)
                                     (current-buffer)))))
+       ;; Output goes in a separate buffer.
        ;; Preserve the match data in case called from a program.
        (save-match-data
          (if (string-match "[ \t]*&[ \t]*$" command)
***************
*** 1368,1380 ****
  systems by binding `coding-system-for-read' and
  `coding-system-for-write'.
  
! If the output is short enough to display in the echo area (which is
! determined by the variable `max-mini-window-height' if
! `resize-mini-windows' is non-nil), it is shown there, but it is
! nonetheless available in buffer `*Shell Command Output*' even though
! that buffer is not automatically displayed.  If there is no output, or
! if output is inserted in the current buffer, then `*Shell Command
! Output*' is deleted.
  
  If the optional fourth argument OUTPUT-BUFFER is non-nil,
  that says to put the output in some other buffer.
--- 1385,1403 ----
  systems by binding `coding-system-for-read' and
  `coding-system-for-write'.
  
! If the command terminates without error, but generates output,
! the output can be displayed in the echo area or in a buffer.
! If the output is short enough to display in the echo area
! \(determined by the variable `max-mini-window-height' if
! `resize-mini-windows' is non-nil), it is shown there.  Otherwise
! it is displayed in the buffer `*Shell Command Output*'.  The output
! is available in that buffer in both cases.
! 
! If there is output in the error, the echo area indicates the error
! and the output is displayed in the buffer `*Shell Command Output*'.
! 
! If there is no output, or if output is inserted in the current buffer,
! then `*Shell Command Output*' is deleted.
  
  If the optional fourth argument OUTPUT-BUFFER is non-nil,
  that says to put the output in some other buffer.
***************
*** 1471,1480 ****
                                           buffer)
                                         nil shell-command-switch command)))
          (setq success (and exit-status (equal 0 exit-status)))
!         ;; Report the amount of output.
          (if (with-current-buffer buffer (> (point-max) (point-min)))
              ;; There's some output, display it
!             (display-message-or-buffer buffer)
            ;; No output; error?
            (message (if (and error-file
                              (< 0 (nth 7 (file-attributes error-file))))
--- 1494,1508 ----
                                           buffer)
                                         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
!             (if (not success)
!                 (with-current-buffer buffer
!                   (goto-char (point-min))
!                   (display-buffer (current-buffer))
!                   (message "(Shell command failed)"))
!               (display-message-or-buffer buffer))
            ;; No output; error?
            (message (if (and error-file
                              (< 0 (nth 7 (file-attributes error-file))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]