unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matthias Meulien <orontee@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 54034@debbugs.gnu.org
Subject: bug#54034: 29.0.50; Diff prettify broken for empty files
Date: Thu, 07 Apr 2022 09:11:08 +0200	[thread overview]
Message-ID: <87sfqpnzar.fsf@gmail.com> (raw)
In-Reply-To: <87wng1omfa.fsf@gmail.com> (Matthias Meulien's message of "Thu, 07 Apr 2022 00:51:37 +0200")

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

Here is an updated patch with a small display improvement: File name
doesn't appear in the middle of the line anymore.


[-- Attachment #2: Capture d’écran du 2022-04-07 09-07-46.png --]
[-- Type: image/png, Size: 116913 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Display-file-mode-information-when-diff-font-lock-pr.patch --]
[-- Type: text/x-diff, Size: 2110 bytes --]

From 35ae0c0d343cc530cb79ee08fbedd641beb212ee Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Thu, 7 Apr 2022 00:47:31 +0200
Subject: [PATCH] Display file mode information when diff font lock prettify
 enabled

* lisp/vc/diff-mode.el (diff--font-lock-prettify): Make regexp capture
file mode information.
---
 lisp/vc/diff-mode.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 251d3dc090..c6409d1677 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2661,12 +2661,14 @@ diff--font-lock-prettify
                                   (match-beginning 5)
                                   (not (match-beginning 3)))
                         " empty")))
-              (filemode (if (match-beginning 10)
-                            (concat " file with mode " (match-string 10) "  ")
-                          " file  "))
-              (modechanged (when (and (match-beginning 8) (match-beginning 9))
-                             (concat " mode changed from "
-                                     (match-string 8) " to " (match-string 9)))))
+              (filemode
+               (cond
+                ((match-beginning 10)
+                 (concat " file with mode " (match-string 10) "  "))
+                ((and (match-beginning 8) (match-beginning 9))
+                 (concat " file (mode changed from "
+                         (match-string 8) " to " (match-string 9) ")  "))
+                (t " file  "))))
           (add-text-properties
            (match-beginning 0) (1- (match-end 0))
            (list 'display
@@ -2680,7 +2682,7 @@ diff--font-lock-prettify
                    ((null (match-string 2))
                     (concat "Deleted" kind filemode oldfile))
                    (t
-                    (concat "Modified" kind " file  " oldfile modechanged)))
+                    (concat "Modified" kind filemode oldfile)))
                   'face '(diff-file-header diff-header))
                  'font-lock-multiline t))))))
   nil)
-- 
2.30.2


  reply	other threads:[~2022-04-07  7:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  7:47 bug#54034: 29.0.50; Diff prettify broken for empty files Matthias Meulien
2022-02-20  7:58 ` Matthias Meulien
2022-02-20 14:40   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-20 16:50     ` Matthias Meulien
2022-02-21 22:23       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 23:00         ` Matthias Meulien
2022-02-21 23:10           ` Matthias Meulien
2022-02-21 23:55           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-22  6:58             ` Matthias Meulien
2022-04-06 22:51               ` Matthias Meulien
2022-04-07  7:11                 ` Matthias Meulien [this message]
2022-04-07  7:19                   ` Matthias Meulien
2022-04-07 12:15                     ` Matthias Meulien
2022-04-07 20:02                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-08 19:41                         ` Matthias Meulien
2022-06-23 22:36                       ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 15:47                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 18:04                           ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 18:22                           ` Matthias Meulien
2022-06-29 18:55                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01 18:56                               ` Matthias Meulien
2022-06-29 19:40                             ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-22  7:16             ` Matthias Meulien

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87sfqpnzar.fsf@gmail.com \
    --to=orontee@gmail.com \
    --cc=54034@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).