From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 54034@debbugs.gnu.org, Matthias Meulien <orontee@gmail.com>
Subject: bug#54034: 29.0.50; Diff prettify broken for empty files
Date: Wed, 29 Jun 2022 11:47:33 -0400 [thread overview]
Message-ID: <jwvsfnnpjd6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87sfnvxb1c.fsf@tcd.ie> (Basil L. Contovounesios's message of "Fri, 24 Jun 2022 01:36:15 +0300")
Basil L. Contovounesios [2022-06-24 01:36:15] wrote:
> I think this gave rise to the following regression in the header when
> diff-font-lock-prettify is enabled:
>
> 0. emacs -Q
> 1. M-x diff-buffers RET RET RET
> [ Header now comprises 'diff -u ...'. ]
> 2. (setq diff-font-lock-prettify t) C-x C-e
> 3. C-x o g
> [ Header is now 'Deleted file'. ]
>
> It's not particularly jarring to see a header like that when diffing
> non-file-visiting buffers, but more importantly the same header appears
> when diffing any regular files via M-x diff.
[ It'd have been better to file a new bug report for this one, FWIW. ]
I installed the patch below, which seems safe, but is probably
not optimal. Matthias?
Stefan
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 0fd67422d55..3f3e503a3f3 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2682,7 +2682,17 @@ diff--font-lock-prettify
((and (null (match-string 4)) (match-string 5))
(concat "New " kind filemode newfile))
((null (match-string 2))
- (concat "Deleted" kind filemode oldfile))
+ ;; We used to use
+ ;; (concat "Deleted" kind filemode oldfile)
+ ;; here but that misfires for `diff-buffers'
+ ;; (see 24 Jun 2022 message in bug#54034).
+ ;; AFAIK if (match-string 2) is nil then so is
+ ;; (match-string 1), so "Deleted" doesn't sound right,
+ ;; so better just let the header in plain sight for now.
+ ;; FIXME: `diff-buffers' should maybe try to better
+ ;; mimic Git's format with "a/" and "b/" so prettification
+ ;; can "just work!"
+ nil)
(t
(concat "Modified" kind filemode oldfile)))
'face '(diff-file-header diff-header))
next prev parent reply other threads:[~2022-06-29 15:47 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
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 [this message]
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=jwvsfnnpjd6.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=54034@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=monnier@iro.umontreal.ca \
--cc=orontee@gmail.com \
/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).