GNU bug report logs - #77313
30.1.50; Regression: flymake indicators are erroneously using margins

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Thu, 27 Mar 2025 15:14:03 UTC

Severity: normal

Found in version 30.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77313 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: bug#77313: 30.1.50; Regression: flymake indicators are erroneously using margins
Date: Thu, 17 Apr 2025 16:23:40 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: 77313 <at> debbugs.gnu.org,  juri <at> linkov.net
>> Date: Wed, 16 Apr 2025 13:57:03 -0400
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> >> Date: Sat, 12 Apr 2025 07:43:11 -0400
>> >> Cc: 77313 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
>> >> 
>> >> On Sat, Apr 12, 2025, 7:13 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>> >> 
>> >>  Thanks, installed on master.
>> >> 
>> >>  Should we now close this bug?
>> >> 
>> >> No, we need to backport it to Emacs 30.2 to fix the regression.
>> >
>> > OK, but it cannot be cherry-picked as is, because it includes a NEWS
>> > entry.  So the fix for emacs-30, when we decide to install it, will
>> > need to be a separate commit.
>> 
>> OK, here is a version ready for backporting to emacs-30, with a NEWS
>> entry appropriate for 30.2.
>
> I don't understand: this seems to be identical to the commit on
> master.  Did you show a wrong patch?
>
> What I had in mind was a change only to flymake.el, with "Do not
> merge" in the commit log message, since you say this is basically a
> bugfix.  I see no reason to announce this in NEWS, let alone with an
> entry that is identical to what we have on master.

I see, that makes sense.  OK, here's a patch like that.

[0001-Backport-fix-flymake-margin-indicator-fallback-logic.patch (text/x-patch, inline)]
From b111266fdc8411f0852088d9eaec22042e841a04 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Thu, 17 Apr 2025 16:22:08 -0400
Subject: [PATCH] Backport: fix flymake margin indicator fallback logic

Backport 861e7f8b60e4bf076bf5991d25a22b3a012746bd to fix bug#77313, so
that fringe indicators are once again reliably the default on frames
that support them.

Do not merge to master.

* lisp/progmodes/flymake.el (flymake-indicator-type)
(flymake-mode): Fix margin fallback behavior.
---
 lisp/progmodes/flymake.el | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index f8a294908ba..a9e15fbbb12 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -185,22 +185,23 @@ flymake-fringe-indicator-position
 		 (const right-fringe)
 		 (const :tag "No fringe indicators" nil)))
 
-(defcustom flymake-indicator-type (if (display-graphic-p)
-                                      'fringes
-                                    'margins)
+(defcustom flymake-indicator-type 'fringes
   "Indicate which indicator type to use for display errors.
 
 The value can be nil (don't indicate errors but just highlight them),
-fringes (use fringes) or margins (use margins)
+the symbol `fringes' (use fringes) or the symbol `margins' (use
+margins).
 
 Difference between fringes and margin is that fringes support displaying
 bitmaps on graphical displays and margins display text in a blank area
 from current buffer that works in both graphical and text displays.
+Thus, even when `fringes' is selected, margins will still be used on
+text displays and also when fringes are disabled.
 
 See Info node `Fringes' and Info node `(elisp)Display Margins'."
-  :version "30.1"
+  :version "30.2"
   :type '(choice (const :tag "Use Fringes" fringes)
-                 (const :tag "Use Margins "margins)
+                 (const :tag "Use Margins" margins)
                  (const :tag "No indicators" nil)))
 
 (defcustom flymake-margin-indicators-string
@@ -1393,6 +1394,13 @@ flymake-mode
     (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t)
     (add-hook 'eldoc-documentation-functions 'flymake-eldoc-function t t)
 
+    (when (and (eq flymake-indicator-type 'fringes)
+               (not (cl-case flymake-fringe-indicator-position
+                      (left-fringe (< 0 (nth 0 (window-fringes))))
+                      (right-fringe (< 0 (nth 1 (window-fringes)))))))
+      ;; There are no fringes in the buffer, fallback to margins.
+      (setq-local flymake-indicator-type 'margins))
+
     ;; AutoResize margins.
     (flymake--resize-margins)
 
-- 
2.39.3


This bug report was last modified 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.