Subject: bug#79222: closed (Re: bug#79222: [PATCH] Fix fringe test in 'diff--font-lock-prettify')

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 16 Aug 2025 09:03:02 +0000

Your bug report

#79222: [PATCH] Fix fringe test in 'diff--font-lock-prettify'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79222: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79222
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79222: [PATCH] Fix fringe test in 'diff--font-lock-prettify'
From: Stefan Monnier <[email-masked]>
To: john muhl <[email-masked]>
Cc: [email-masked]
Date: Sat, 16 Aug 2025 05:02:18 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Thank John!

Pushed to `master`.
I added a comment about the "wasted" 4-element list that's constructed
by `window-fringes`, but not before having noticed that
`frame-parameter` was even worse.

        Stefan

john muhl [2025-08-12 00:03:35] wrote:
> With diff-font-lock-prettify enabled opening a diff (or having Gnus try
> to render one, &c) in a tty frame causes an error since 'left-fringe is
> nil in that case.
>
>   emacs -Q -nw -eval "(setopt diff-font-lock-prettify t)" some.diff
>
> From 50314aaae7287b03754315a5ad7aa922c417cdb2 Mon Sep 17 00:00:00 2001
> From: john muhl <[email-masked]>
> Date: Mon, 11 Aug 2025 17:43:20 -0500
> Subject: [PATCH] Fix fringe width test in 'diff--font-lock-prettify'
>
> * lisp/vc/diff-mode.el (diff--font-lock-prettify):
> Use 'window-fringes' instead of the 'left-fringe' frame parameter
> since the former returns an integer on both GUI and TTY frames.
> ---
>  lisp/vc/diff-mode.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
> index 31a505f19be..df72cecb749 100644
> --- a/lisp/vc/diff-mode.el
> +++ b/lisp/vc/diff-mode.el
> @@ -2949,7 +2949,7 @@ 'diff-fringe-nul
>  
>  (defun diff--font-lock-prettify (limit)
>    (when diff-font-lock-prettify
> -    (when (> (frame-parameter nil 'left-fringe) 0)
> +    (when (> (car (window-fringes)) 0)
>        (save-excursion
>          ;; FIXME: Include the first space for context-style hunks!
>          (while (re-search-forward "^[-+! ]" limit t)

Subject: [PATCH] Fix fringe test in 'diff--font-lock-prettify'
From: john muhl <[email-masked]>
To: [email-masked]
Date: Tue, 12 Aug 2025 00:03:35 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

With diff-font-lock-prettify enabled opening a diff (or having Gnus try
to render one, &c) in a tty frame causes an error since 'left-fringe is
nil in that case.

  emacs -Q -nw -eval "(setopt diff-font-lock-prettify t)" some.diff

>From 50314aaae7287b03754315a5ad7aa922c417cdb2 Mon Sep 17 00:00:00 2001
From: john muhl <[email-masked]>
Date: Mon, 11 Aug 2025 17:43:20 -0500
Subject: [PATCH] Fix fringe width test in 'diff--font-lock-prettify'

* lisp/vc/diff-mode.el (diff--font-lock-prettify):
Use 'window-fringes' instead of the 'left-fringe' frame parameter
since the former returns an integer on both GUI and TTY frames.
---
 lisp/vc/diff-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 31a505f19be..df72cecb749 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2949,7 +2949,7 @@ 'diff-fringe-nul
 
 (defun diff--font-lock-prettify (limit)
   (when diff-font-lock-prettify
-    (when (> (frame-parameter nil 'left-fringe) 0)
+    (when (> (car (window-fringes)) 0)
       (save-excursion
         ;; FIXME: Include the first space for context-style hunks!
         (while (re-search-forward "^[-+! ]" limit t)
-- 
2.50.1