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


Message #56 received at 77313 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#77313: 30.1.50; Regression: flymake indicators are
 erroneously using margins
Date: Tue, 08 Apr 2025 10:56:20 -0400
[Message part 1 (text/plain, inline)]
Spencer Baugh <sbaugh <at> janestreet.com> writes:
> 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: Tue, 08 Apr 2025 08:46:17 -0400
>>> 
>>> Here's an updated version of my previous patch which avoids the need for
>>> a new variant in the defcustom.  When flymake-indicator-type is set to
>>> fringes and we're on a text frame, we simply fall back to using margins.
>>> That allows it to be set to fringes by default without losing
>>> functionality for text terminals; this is how this should have been
>>> implemented originally.
>>
>> I think we should also fall back on using margins if the fringes are
>> disabled on GUI frames.
>
> Disabled how?  I don't see a way to disable the fringe.  Do you mean
> when the fringe width is set to 0?  So are you suggesting we should call
> window-fringes and check the width of the fringe we're going to use?  I
> can do that, just want to confirm.

Assuming that's what you mean, here's the updated patch.

[0001-flymake-fall-back-to-margins-on-text-terminals.patch (text/x-patch, inline)]
From 555ebfec9641d535778dfc6295f4accb70557721 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Tue, 8 Apr 2025 08:43:37 -0400
Subject: [PATCH] flymake: fall back to margins on text terminals

Previously, flymake-indicator-type defaulted to either fringes
or margins.  But fringes should be used on graphical frames, and
margins on TTY frames.  So default to fringes instead, and
simply fall back to margins automatically on text frames.

* lisp/progmodes/flymake.el (flymake-indicator-type): Set to
fringes.  (bug#77313)
(flymake-mode): Fallback to margins if there's no fringes.
---
 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 6cc7e1f7a79..7340fed9be4 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 "31.1"
   :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
@@ -1439,6 +1440,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.