GNU bug report logs -
#54034
29.0.50; Diff prettify broken for empty files
Previous Next
Full log
Message #56 received at 54034 <at> debbugs.gnu.org (full text, mbox):
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))
This bug report was last modified 2 years and 350 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.