Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Always send shell output to a buffer

  • Loading branch information...
commit 4411c8e5e5aecd9ba62e6d51fb92ef569bf3b2ac 1 parent d9ce6c6
@ramen ramen authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 ramen/shell-output-to-buffer.el
18 ramen/shell-output-to-buffer.el
@@ -0,0 +1,18 @@
+;;; shell-output-to-buffer.el --- Always send shell output to a buffer
+;; Normally, output from commands like shell-command-on-region go either to
+;; the echo area or a buffer depending the size of the output. I prefer my
+;; output in a buffer every time so that I can edit it, even if it is small.
+;; Redefine display-message-or-buffer so that it always uses a buffer.
+(defun display-message-or-buffer (message &optional buffer-name not-this-window frame)
+ "Display MESSAGE in a pop-up buffer. MESSAGE may be either a string or a buffer."
+ (with-current-buffer
+ (if (bufferp message)
+ message
+ (get-buffer-create (or buffer-name "*Message*")))
+ (unless (bufferp message)
+ (erase-buffer)
+ (insert message))
+ (goto-char (point-min))
+ (display-buffer (current-buffer) not-this-window frame)))
Please sign in to comment.
Something went wrong with that request. Please try again.