unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: 40821@debbugs.gnu.org
Subject: bug#40821: Margin strings are displayed in reverse order of overlay priority (low-priority specs hide high-priority ones)
Date: Sat, 25 Apr 2020 10:58:31 +0300	[thread overview]
Message-ID: <83o8rg809k.fsf@gnu.org> (raw)
In-Reply-To: <33007735-30b9-4c52-c440-929686e1cb0e@gmail.com> (message from Clément Pit-Claudel on Fri, 24 Apr 2020 11:56:45 -0400)

severity 40821 wishlist
thanks

> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Fri, 24 Apr 2020 11:56:45 -0400
> 
> All three overlays begin at the same point.  Currently, it seems that margin specs are concatenated in order of increasing priority.  This is likely due to before-strings being concatenated in that order?

The strings are not concatenated, they are displayed one after
another, in the order they are processed by the display engine.

The overlays at a given buffer position are indeed sorted.  First,
before-strings should come before after-strings, and within each class
the overlays are sorted in the order of increasing priority.  Then the
sorted overlays are processed one by one in the sorted order.

> One unfortunate side effect of this is that, when margins are too narrow, low-priority margin specs are displayed before high-priority ones, and hence high-priority ones are not visible.

Yes, the display margins use this very simple strategy of truncating
the stuff that has no margin space to be displayed.  Why can't you
compute the width of the margins taking into consideration the size of
what you need to display there?

> Additionally, unlike fringe bitmaps, for which the highest-priority bitmap replaces all others on the same line, there doesn't seem to be a way for higher-priority margin specs to replace lower-priority ones.

First, I don't understand what you say about fringe bitmaps: I don't
think there's any priority associated with those bitmaps, or what am I
missing?

It should be possible to support this idea of "replacing" margin specs
(which seems strange to me, FWIW), given some special display spec,
but it would need a separate pass through the overlays, to find those
which draw in the margins, and mark the replaced ones as "not to be
processed".  But I question the need for such a complexity, when a
simpler solution that doesn't require any changes seems to be at hand.

> This issue came up when trying to develop a mode to indicate errors and warnings in the margins (instead of drawing symbols in the fringes).  Currently, if a line contains errors and warnings, Flycheck will place multiple overlays on the same line, and the fringe bitmap corresponding to the highest-priority one will be displayed.  But if we put a symbol in the margins instead of the fringes, the symbols won't override each others: instead, they will be concatenated, often in the wrong order (as shown in the attached screenshot).

A simple way of overcoming this problem is to define the overlay
priorities in the reverse order of the Flycheck's error/warning
priorities.  A better solution would be to make the margin wider as
needed, something that should be easy enough (line-number-mode did
that, for example).





  reply	other threads:[~2020-04-25  7:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 15:56 bug#40821: Margin strings are displayed in reverse order of overlay priority (low-priority specs hide high-priority ones) Clément Pit-Claudel
2020-04-25  7:58 ` Eli Zaretskii [this message]
2020-04-25 13:01   ` Clément Pit-Claudel
2020-04-25 14:04     ` Eli Zaretskii
2020-04-25 16:51       ` Clément Pit-Claudel
2020-04-25 17:08         ` Eli Zaretskii
2020-04-25 17:21           ` Clément Pit-Claudel
2020-04-25 17:36             ` Eli Zaretskii
2020-04-25 19:29               ` Dmitry Gutov
2020-04-25 20:50               ` Clément Pit-Claudel
2020-05-13 15:58   ` Clément Pit-Claudel
2020-05-13 16:25     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83o8rg809k.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=40821@debbugs.gnu.org \
    --cc=cpitclaudel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).