From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32474: 27.0.50; Gnus doesn't highlight refined changes in diff attachments Date: Mon, 20 Aug 2018 00:20:02 +0300 Organization: LINKOV.NET Message-ID: <87r2iuavvh.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1534715292 4018 195.159.176.226 (19 Aug 2018 21:48:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Aug 2018 21:48:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 32474@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 19 23:48:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frVYM-0000sn-KM for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Aug 2018 23:48:06 +0200 Original-Received: from localhost ([::1]:44208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frVaT-0002Yh-2h for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Aug 2018 17:50:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frVaF-0002PM-JO for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:50:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frVaE-0002Jm-Oa for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:50:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49860) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frVaE-0002Jh-LE for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1frVaE-0003ze-Hr for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 21:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32474 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153471537115298 (code B ref -1); Sun, 19 Aug 2018 21:50:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Aug 2018 21:49:31 +0000 Original-Received: from localhost ([127.0.0.1]:54876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frVZj-0003ye-HO for submit@debbugs.gnu.org; Sun, 19 Aug 2018 17:49:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frVZg-0003yK-8J for submit@debbugs.gnu.org; Sun, 19 Aug 2018 17:49:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frVZa-000273-AU for submit@debbugs.gnu.org; Sun, 19 Aug 2018 17:49:23 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45399) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frVZa-00026s-7Q for submit@debbugs.gnu.org; Sun, 19 Aug 2018 17:49:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frVZZ-00022g-Bb for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:49:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frVZW-00025A-75 for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:49:21 -0400 Original-Received: from homie-sub3.mail.dreamhost.com ([69.163.253.7]:46239 helo=homiemail-a22.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frVZW-00024t-0j for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 17:49:18 -0400 Original-Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id ED4A1114066 for ; Sun, 19 Aug 2018 14:49:16 -0700 (PDT) Original-Received: from localhost.linkov.net (m91-129-110-6.cust.tele2.ee [91.129.110.6]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPSA id C4E09114065 for ; Sun, 19 Aug 2018 14:49:14 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149601 Archived-At: --=-=-= Content-Type: text/plain Since refined changes in diff attachments are highlighted using overlays, they need special treatment to be copied together with text properties: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=gnus-mm-view.1.patch 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 --=-=-=--