all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 32474@debbugs.gnu.org
Subject: bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments
Date: Mon, 20 Aug 2018 00:20:02 +0300	[thread overview]
Message-ID: <87r2iuavvh.fsf@mail.linkov.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

Since refined changes in diff attachments are highlighted using overlays,
they need special treatment to be copied together with text properties:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-mm-view.1.patch --]
[-- Type: text/x-diff, Size: 1393 bytes --]

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 50a927bce2..0b15f6b188 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -452,7 +452,7 @@ mm-display-inline-fontify
   "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 @@ mm-display-inline-fontify
 		      (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	other threads:[~2018-08-19 21:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-19 21:20 Juri Linkov [this message]
2018-08-30 22:17 ` bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2iuavvh.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=32474@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.