all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments
@ 2018-08-19 21:20 Juri Linkov
  2018-08-30 22:17 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2018-08-19 21:20 UTC (permalink / raw
  To: 32474

[-- 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments
  2018-08-19 21:20 bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments Juri Linkov
@ 2018-08-30 22:17 ` Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2018-08-30 22:17 UTC (permalink / raw
  To: 32474-done

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

Done in eb5588db69.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-30 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-19 21:20 bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments Juri Linkov
2018-08-30 22:17 ` Juri Linkov

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.