Colorise output from commands so that it looks like it's on purpose
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 1 Aug 2013 21:22:56 +0000 (23:22 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 1 Aug 2013 21:22:56 +0000 (23:22 +0200)
* mm-decode.el (mm-command-output): New face.
(mm-display-external): Use it.

lisp/ChangeLog
lisp/mm-decode.el

index 81fef13..7edcaf4 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-01  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-decode.el (mm-command-output): New face.
+       (mm-display-external): Use it.
+
 2013-08-01  Kan-Ru Chen (陳侃如)  <kanru@kanru.info>  (tiny change)
 
        * nnmbox.el (nnmbox-request-article): Don't change point.
index 98be1c5..7274708 100644 (file)
   :group 'news
   :group 'multimedia)
 
+(defface mm-command-output
+  '((((class color)
+      (background dark))
+     (:foreground "ForestGreen"))
+    (((class color)
+      (background light))
+     (:foreground "red3"))
+    (t
+     (:italic t)))
+  "Face used for displaying output from commands."
+  :group 'mime-display)
+
 ;;; Convenience macros.
 
 (defmacro mm-handle-buffer (handle)
@@ -983,9 +995,12 @@ external if displayed external."
                               (let ((buffer-read-only nil)
                                     (point (point)))
                                 (forward-line 2)
-                                (mm-insert-inline
-                                 handle (with-current-buffer buffer
-                                          (buffer-string)))
+                                (let ((start (point)))
+                                  (mm-insert-inline
+                                   handle (with-current-buffer buffer
+                                            (buffer-string)))
+                                  (put-text-property start (point)
+                                                     'face 'mm-command-output))
                                 (goto-char point))))
                           (when (buffer-live-p buffer)
                             (kill-buffer buffer)))