emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master eb5588d: * lisp/gnus/mm-view.el (mm-display-inline-


From: Juri Linkov
Subject: [Emacs-diffs] master eb5588d: * lisp/gnus/mm-view.el (mm-display-inline-fontify): Carry diff-mode overlays
Date: Thu, 30 Aug 2018 18:16:06 -0400 (EDT)

branch: master
commit eb5588db69b3134832f79447dfba59333be41e8b
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/gnus/mm-view.el (mm-display-inline-fontify): Carry diff-mode overlays
    
    to inline MIME attachments from the temp buffer along with text properties.
    (Bug#32474)
---
 lisp/gnus/mm-view.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 50a927b..15eac11 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -452,7 +452,7 @@
   "Insert HANDLE inline fontifying with MODE.
 If MODE is not set, try to find mode automatically."
   (let ((charset (mail-content-type-get (mm-handle-type handle) 'charset))
-       text coding-system)
+       text coding-system ovs)
     (unless (eq charset 'gnus-decoded)
       (mm-with-unibyte-buffer
        (mm-insert-part handle)
@@ -498,10 +498,18 @@ If MODE is not set, try to find mode automatically."
                      (eq major-mode 'fundamental-mode))
            (font-lock-ensure))))
       (setq text (buffer-string))
+      (when (eq mode 'diff-mode)
+       (setq ovs (mapcar (lambda (ov) (list ov (overlay-start ov)
+                                               (overlay-end ov)))
+                         (overlays-in (point-min) (point-max)))))
       ;; Set buffer unmodified to avoid confirmation when killing the
       ;; buffer.
       (set-buffer-modified-p nil))
-    (mm-insert-inline handle text)))
+    (let ((b (1- (point))))
+      (mm-insert-inline handle text)
+      (dolist (ov ovs)
+       (move-overlay (nth 0 ov) (+ (nth 1 ov) b)
+                                (+ (nth 2 ov) b) (current-buffer))))))
 
 ;; Shouldn't these functions check whether the user even wants to use
 ;; font-lock?  Also, it would be nice to change for the size of the



reply via email to

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