Hi Eli and Yuri, On 13/05/2017 10.27, Eli Zaretskii wrote:>> From: Yuri Khan >> 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.