unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52810: 29.0.50; diff-font-lock-prettify broken on new and deleted files
@ 2021-12-26 19:56 Matthias Meulien
  2021-12-29 16:26 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Meulien @ 2021-12-26 19:56 UTC (permalink / raw)
  To: 52810

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


1. Configure Diff mode to enable font lock prettify:

(add-hook 'diff-mode-hook #'(lambda ()
			      (setq diff-font-lock-prettify t)))

2. Visit the recent change log of emacs sources (eg C-x v L when
visiting one of emacs source file)

3. Find commit 3d38d1d134 and call log-view-diff

4. Jump to line 245 for the chunk applying to lisp/sqlite.el

5. Observe the strange line:

new file   lisp/sqlite.ellisp/sqlite.el

where "new file   lisp/sqlite.el" is expected.


[-- Attachment #2: Type: image/png, Size: 147563 bytes --]

[-- Attachment #3: Type: text/plain, Size: 163 bytes --]


A similar problem can be observed for deleted files.

Proposed fixed (but I must confess I've no idea why the original code
tried to set two distinct overlays):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-Fix-diff-font-lock-prettify-broken-on-created-or-del.patch --]
[-- Type: text/x-diff, Size: 2221 bytes --]

From 0f9a40a1514fc5cf4e04bcdb69db7eb30dd0c6ba Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Sun, 26 Dec 2021 18:39:57 +0100
Subject: [PATCH] Fix diff--font-lock-prettify broken on created or deleted
 files

---
 lisp/vc/diff-mode.el | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 8f83aa580e..60d210ca22 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2612,19 +2612,17 @@ diff--font-lock-prettify
                          "\\(?:index.*\n\\)?"
                          "--- \\(?:" null-device "\\|a/\\(.*\\)\\)\n"
                          "\\+\\+\\+ \\(?:" null-device "\\|b/\\(.*\\)\\)\n"))))
-        (put-text-property (match-beginning 0)
-                           (or (match-beginning 2) (match-beginning 1))
-                           'display (propertize
-                                     (cond
-                                      ((null (match-beginning 1))
-                                       (concat "new file  " (match-string 2)))
-                                      ((null (match-beginning 2))
-                                       (concat "deleted   " (match-string 1)))
-                                      (t
-                                       (concat "modified  " (match-string 1))))
-                                     'face '(diff-file-header diff-header)))
-        (put-text-property (match-end 1) (1- (match-end 0))
-                           'display ""))))
+        (put-text-property (match-beginning 0) (1- (match-end 0))
+                           'display
+                           (propertize
+                            (cond
+                             ((null (match-string 1))
+                              (concat "new file  " (match-string 2)))
+                             ((null (match-string 2))
+                              (concat "deleted  " (match-string 1)))
+                             (t
+                              (concat "modified  " (match-string 1))))
+                            'face '(diff-file-header diff-header))))))
   nil)
 
 ;;; Syntax highlighting from font-lock
-- 
2.30.2


[-- Attachment #5: Type: text/plain, Size: 6763 bytes --]




In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-12-11 built on carbon
Repository revision: 15553f936abcc9c0bc85a2cd245319de273ee523
Repository branch: temp
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Apropos

Minor modes in effect:
  highlight-changes-visible-mode: t
  shell-dirtrack-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  desktop-save-mode: t
  save-place-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  text-scale-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/transient-20211105.100/transient hides /usr/local/share/emacs/29.0.50/lisp/transient
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.0.50/lisp/net/dictionary

Features:
(shadow emacsbug apropos make-mode mailalias smtpmail sendmail generic
grep sort smiley gnus-cite mail-extr gnus-async gnus-bcklg qp gnus-ml
gnus-topic nndraft nnmh nnfolder utf-7 epa-file gnutls network-stream
nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-cache texinfo texinfo-loaddefs autoconf autoconf-mode edebug pulse
shortdoc dabbrev log-edit misearch multi-isearch cl-print help-fns
radix-tree log-view pcvs-util reftex-dcr reftex reftex-loaddefs
reftex-vars tex-mode typescript-mode hideshow cap-words superword
subword js enriched disp-table facemenu reveal yaml-mode python tramp-sh
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
ls-lisp feature-mode cucumber-mode perl-mode sh-script smie executable
hl-line smerge-mode diff flyspell ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar org-agenda ox-html table ox-ascii
ox-publish ox org-element avl-tree ol-eww eww xdg url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search eieio-opt
speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view mml-smime smime
dig gnus-sum shr pixel-fill kinsoku svg dom ol-docview doc-view
image-mode exif ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi mule-util
add-log view follow bug-reference erts-mode vc-dir dired-aux goto-addr
display-line-numbers hilit-chg jka-compr whitespace vc-mtn vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc bash-completion shell eglot array
jsonrpc ert ewoc debug backtrace flymake-proc flymake compile imenu
company-oddmuse company-keywords company-etags etags fileloop generator
xref project company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb avoid minions company pcase carbon-custom
cus-edit cus-load gnus-demon nntp gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc
parse-time gnus-spec gnus-win nnoo gnus-int gnus-range message
yank-media rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus nnheader gnus-util rmail rmail-loaddefs
rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr wid-edit
gnus-dired dired-x dired dired-loaddefs org-capture org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities org-version ob-emacs-lisp ob-core ob-eval
org-table oc-basic bibtex iso8601 time-date ol org-keys oc org-compat
org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs dictionary link connection advice markdown-mode
edit-indirect color thingatpt noutline outline skeleton find-file vc-git
diff-mode easy-mmode vc-dispatcher ispell comp comp-cstr warnings rx
cl-extra help-mode desktop frameset server bookmark text-property-search
pp saveplace elec-pair icomplete so-long autorevert filenotify
autoinsert cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs generic-x face-remap proof-site
proof-autoloads info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json map url-vars seq gv subr-x
byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1292883 149347)
 (symbols 48 43725 5)
 (strings 32 217988 10513)
 (string-bytes 1 9128224)
 (vectors 16 95840)
 (vector-slots 8 2474388 186797)
 (floats 8 754 1282)
 (intervals 56 118271 611)
 (buffers 992 242))

-- 
Matthias

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#52810: 29.0.50; diff-font-lock-prettify broken on new and deleted files
  2021-12-26 19:56 bug#52810: 29.0.50; diff-font-lock-prettify broken on new and deleted files Matthias Meulien
@ 2021-12-29 16:26 ` Lars Ingebrigtsen
  2022-01-15 12:32   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-29 16:26 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: 52810

Matthias Meulien <orontee@gmail.com> writes:

> Proposed fixed

Thanks; applied to Emacs 28.

> (but I must confess I've no idea why the original code
> tried to set two distinct overlays):

There's no overlays here -- do you mean display text properties?

Anyway, the code was originally the below, but that was changed in
f0768d31457.

-                                      ((null (match-beginning 1)) "new file  ")
-                                      ((null (match-beginning 2)) "deleted   ")
-                                      (t                          "modified  "))
+                                      ((null (match-beginning 1))
+                                       (concat "new file  " (match-string 2)))
+                                      ((null (match-beginning 2))
+                                       (concat "deleted   " (match-string 1)))
+                                      (t
+                                       (concat "modified  " (match-string 1))))
                                      'face '(diff-file-header diff-header)))
-        (unless (match-beginning 2)
-          (put-text-property (match-end 1) (1- (match-end 0))
-                             'display "")))))
+        (put-text-property (match-end 1) (1- (match-end 0))
+                           'display ""))))


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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#52810: 29.0.50; diff-font-lock-prettify broken on new and deleted files
  2021-12-29 16:26 ` Lars Ingebrigtsen
@ 2022-01-15 12:32   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-15 12:32 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: 52810

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Proposed fixed
>
> Thanks; applied to Emacs 28.

Apparently I forgot to close this bug report, so I'm doing that now.

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-15 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-26 19:56 bug#52810: 29.0.50; diff-font-lock-prettify broken on new and deleted files Matthias Meulien
2021-12-29 16:26 ` Lars Ingebrigtsen
2022-01-15 12:32   ` Lars Ingebrigtsen

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).