GNU bug report logs - #42300
Visual bug in diff-mode

Previous Next

Package: emacs;

Reported by: Gregory Heytings <ghe <at> sdf.org>

Date: Thu, 9 Jul 2020 23:27:01 UTC

Severity: normal

Tags: confirmed, fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42300 in the body.
You can then email your comments to 42300 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42300; Package emacs. (Thu, 09 Jul 2020 23:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gregory Heytings <ghe <at> sdf.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 09 Jul 2020 23:27:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <ghe <at> sdf.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Visual bug in diff-mode
Date: Thu, 9 Jul 2020 21:23:36 +0200 (CEST)
Diff-mode was updated in Emacs 27, and it is now possible to use the 
fringe to indicate whether the lines were added, deleted, or are common. 
The face is omitted in the display property in the case common lines, 
which leads to the bug described below.

Steps to reproduce:

1. start emacs -Q
2. (setq diff-font-lock-prettify t)
3. to make the bug clearly visible: (set-face-attribute 'fringe nil :background "red" :foreground "yellow")
4. open a diff file (with "common" lines, that is, lines starting with a space)
5. observe that the fringe in front of the common lines is red
6. press C-x C-+, the fringe in front of the common lines is now white
7. press -, the fringe in front of the common lines is now red again

Fix:

--- diff-mode.el.orig	2020-06-29 17:39:26.000000000 +0000
+++ diff-mode.el	2020-07-09 18:44:08.000000000 +0000
@@ -2518,7 +2518,7 @@
                                '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
                                  (?- . (left-fringe diff-fringe-del diff-indicator-removed))
                                  (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
-                                 (?\s . (left-fringe diff-fringe-nul))))))
+                                 (?\s . (left-fringe diff-fringe-nul fringe))))))
           (put-text-property (match-beginning 0) (match-end 0) 'display spec))))
     ;; Mimicks the output of Magit's diff.
     ;; FIXME: This has only been tested with Git's diff output.




Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 16:14:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 16:24:01 GMT) Full text and rfc822 format available.

bug Marked as found in versions 28.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 13 Aug 2020 16:24:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42300; Package emacs. (Thu, 13 Aug 2020 16:25:01 GMT) Full text and rfc822 format available.

Message #14 received at 42300 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Gregory Heytings <ghe <at> sdf.org>
Cc: 42300 <at> debbugs.gnu.org
Subject: Re: bug#42300: Visual bug in diff-mode
Date: Thu, 13 Aug 2020 09:23:52 -0700
tags 42300 + confirmed
found 42300 28.0.50
thanks

Gregory Heytings <ghe <at> sdf.org> writes:

> Diff-mode was updated in Emacs 27, and it is now possible to use the fringe to
> indicate whether the lines were added, deleted, or are common. The face is
> omitted in the display property in the case common lines, which leads to the bug
> described below.
>
> Steps to reproduce:
>
> 1. start emacs -Q
> 2. (setq diff-font-lock-prettify t)
> 3. to make the bug clearly visible: (set-face-attribute 'fringe nil :background "red" :foreground "yellow")
> 4. open a diff file (with "common" lines, that is, lines starting with a space)
> 5. observe that the fringe in front of the common lines is red
> 6. press C-x C-+, the fringe in front of the common lines is now white
> 7. press -, the fringe in front of the common lines is now red again

I can reproduce this on current master, and verify that the below change
fixes it.

I'm not that familiar with diff-mode.ela nor font-locking so it's better
that someone else takes a look and installs the fix.

> --- diff-mode.el.orig	2020-06-29 17:39:26.000000000 +0000
> +++ diff-mode.el	2020-07-09 18:44:08.000000000 +0000
> @@ -2518,7 +2518,7 @@
>                                 '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
>                                   (?- . (left-fringe diff-fringe-del diff-indicator-removed))
>                                   (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
> -                                 (?\s . (left-fringe diff-fringe-nul))))))
> +                                 (?\s . (left-fringe diff-fringe-nul fringe))))))
>            (put-text-property (match-beginning 0) (match-end 0) 'display spec))))
>      ;; Mimicks the output of Magit's diff.
>      ;; FIXME: This has only been tested with Git's diff output.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42300; Package emacs. (Fri, 14 Aug 2020 15:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 42300 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Gregory Heytings <ghe <at> sdf.org>, 42300 <at> debbugs.gnu.org
Subject: Re: bug#42300: Visual bug in diff-mode
Date: Fri, 14 Aug 2020 17:33:49 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> I can reproduce this on current master, and verify that the below change
> fixes it.
>
> I'm not that familiar with diff-mode.ela nor font-locking so it's better
> that someone else takes a look and installs the fix.

I'm not very familiar with that, either, but it seems "obviously
correct", if I understand that code correctly.  So I went ahead and
pushed it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 14 Aug 2020 15:35:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 42300 <at> debbugs.gnu.org and Gregory Heytings <ghe <at> sdf.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 14 Aug 2020 15:35:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 12 Sep 2020 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.