bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26909: 25.1; A face for margins


From: Clément Pit-Claudel
Subject: bug#26909: 25.1; A face for margins
Date: Mon, 11 May 2020 17:01:23 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Hi Eli and Yuri,

On 13/05/2017 10.27, Eli Zaretskii wrote:>> From: Yuri Khan 
<yuri.v.khan@gmail.com>
>> Date: Sat, 13 May 2017 21:07:03 +0700
>>
>> The last two actions demonstrate that customizing the faces of
>> whatever is displayed in the margin is not sufficient. A mechanism is
>> needed that will allow customization of the margin where nothing is
>> displayed. A new face would serve nicely.
> 
> A face can only affect places where something is displayed using that
> face.  Display margins only display text if the buffer specifies text
> properties or overlays which display in the margins.  But what you
> would like to do calls for having a face that would affect screen
> space where _nothing_ is displayed, and such screen space in Emacs is
> always displayed using the frame's background color, not by using some
> face.
> 
> IOW, I don't think introducing a new face would help here.  Some
> additional mechanism would be necessary.

A margin face would be great to have.  
How reasonable would it be to fill the margins with a stretched space?  Would 
it be too costly?
Currently we almost do that in extend_face_to_end_of_line, but short-circuits 
earlier in that function mean that this part is only applicable when there is 
e.g. a region.


  if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0
      && it->glyph_row->used[LEFT_MARGIN_AREA] == 0)
    {
      it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph;
      it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id =
        default_face->id;
      it->glyph_row->used[LEFT_MARGIN_AREA] = 1;
    }
  if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0
      && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0)
    {
      it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph;
      it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id =
        default_face->id;
      it->glyph_row->used[RIGHT_MARGIN_AREA] = 1;
    }

The (silly) attached patch confirms that removing the short-circuits makes it 
possible to set a face in the margins, but besides the performance aspect it 
only applies to lines that have contents.

Is this a reasonable way to go? If not, what might be better way?

Clément.

Attachment: 0001-Add-a-margin-face-remove-short-circuits-in-extend_fa.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]