From 8394e6069f38259b1a6f882ed5ee954ad6130c64 Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Mon, 24 Mar 2014 09:17:25 +0100 Subject: [PATCH] * mu4e/mu4e-view.el (mu4e-mark-region-code): New function to highlight region marked with `message-mark-inserted-region'. * mu4e/mu4e-vars.el (mu4e-region-code): New face. --- mu4e/mu4e-vars.el | 7 ++++++- mu4e/mu4e-view.el | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index 73c22f1c..cb7006d2 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -524,7 +524,12 @@ mu4e-compose-mode." "Face for the separator between headers / message in mu4e-compose-mode." :group 'mu4e-faces) - + +(defface mu4e-region-code + '((t (:background "DarkSlateGray"))) + "Face for highlighting marked region in mu4e-view buffer." + :group 'mu4e-faces) + ;; headers info (defconst mu4e-header-info '( (:attachments . diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index f6cf9221..67248f32 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -903,6 +903,30 @@ all messages in the subthread at point in the headers view." (interactive) (mu4e~view-in-headers-context (mu4e-headers-search-edit))) +(defun mu4e-mark-region-code () + (require 'message) + (let (beg end ov-beg ov-end ov-inv) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward + (concat "^" message-mark-insert-begin) nil t) + (setq ov-beg (match-beginning 0) + ov-end (match-end 0) + ov-inv (make-overlay ov-beg ov-end) + beg ov-end) + (overlay-put ov-inv 'invisible t) + (when (re-search-forward + (concat "^" message-mark-insert-end) nil t) + (setq ov-beg (match-beginning 0) + ov-end (match-end 0) + ov-inv (make-overlay ov-beg ov-end) + end ov-beg) + (overlay-put ov-inv 'invisible t)) + (when (and beg end) + (let ((ov (make-overlay beg end))) + (overlay-put ov 'face 'mu4e-region-code)) + (setq beg nil end nil)))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; attachment handling (defun mu4e~view-get-attach-num (prompt msg &optional multi)