Subject: Re: bug#33740: [PATCH] Customizable flymake mode-line indicator

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 19 Sep 2019 17:55:00 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Then try this:
>
> (setq flymake--mode-line-format (concat (propertize " bar " 'face 'bold) "foo"))
>
> Both "bar" and "foo" will be bold in the mode line.

I...  think I know why this is happening.

Mixing the two ways of specifying text properties isn't really allowed.

`mode-line-modes' has this:

 (:propertize
  ("" minor-mode-alist)
  mouse-face mode-line-highlight help-echo "Minor mode\nmouse-1: Display minor m
  ...

display_mode_element does this for strings:

	    Lisp_Object oprops, aelt;
	    oprops = Ftext_properties_at (make_fixnum (0), elt);

	    /* If the starting string's properties are not what
	       we want, translate the string.  Also, if the string
	       is risky, do that anyway.  */

	    if (NILP (Fequal (props, oprops)) || risky)
	      {
		/* If the starting string has properties,
		   merge the specified ones onto the existing ones.  */
		if (! NILP (oprops) && !risky)

So we basically do exactly what I was seeing -- overwrite the entire
string's text properties with the text property in the first character
of the string.

But!

This is only done if the string is inside a (:propertize ...) clause,
because this is only done of props is passed in, which (if I read the
code correctly) only happens if that's done.

But the code in that function could be clearer -- I don't really
understand why this is done at all.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no