From bb86261cbcc9d0f25730e0044042e43748b84134 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 17 Aug 2015 22:18:21 +0000 Subject: [PATCH] * message.el (message-toggle-image-thumbnails): New command. --- lisp/gnus/message.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 447a8d79e39..bc6185fd517 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8546,14 +8546,44 @@ Used in `message-simplify-recipients'." ;;; multipart/related and HTML support. (defun message-make-html-message-with-image-files (files) + "Make a message containing the current dired-marked image files." (interactive (list (dired-get-marked-files nil current-prefix-arg))) (message-mail) (message-goto-body) (insert "<#part type=text/html>\n\n") (dolist (file files) (insert (format "\n\n" file))) + (message-toggle-image-thumbnails) (message-goto-to)) +(defun message-toggle-image-thumbnails () + "For any included image files, insert a thumbnail of that image." + (interactive) + (let ((overlays (overlays-in (point-min) (point-max))) + (displayed nil)) + (while overlays + (let ((overlay (car overlays))) + (when (overlay-get overlay 'put-image) + (delete-overlay overlay) + (setq displayed t))) + (setq overlays (cdr overlays))) + (unless displayed + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "