Subject: Re: bug#26909: 25.1; A face for margins

From: Eli Zaretskii <[email-masked]>
Date: Tue, 12 May 2020 19:52:29 +0300

> Cc: [email-masked]
> From: Clément Pit-Claudel <[email-masked]>
> Date: Mon, 11 May 2020 17:01:23 -0400
> 
> 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?

It would slow down redisplay, especially if the window is large, but
maybe the slow-down will not be so awful.

> 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?

Something like that, yes.  But you will need to make sure
extend_face_to_end_of_line is called also for empty lines.  And of
course the "silly" changes need to be made less silly.  And you need
to compute the pixel-width of the stretch glyph, since the code you
cited only places a single SPC character there, which is not what you
want if the margin is wider than one column.

> --- a/src/xfaces.c
> +++ b/src/xfaces.c
> @@ -4768,6 +4768,7 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id)
>      case TAB_BAR_FACE_ID:		name = Qtab_bar;		break;
>      case TOOL_BAR_FACE_ID:		name = Qtool_bar;		break;
>      case FRINGE_FACE_ID:		name = Qfringe;			break;
> +    case MARGIN_FACE_ID:		name = Qmargin;			break;

If this is going to be an additional basic face, then why do you call
lookup_named_face  and not lookup_basic_face?

Also, this face should have a defface definition in faces.el.  (And
NEWS, and update for the manuals...)

Thanks.