>>> But it would be better to have there a test which would tell us >>> whether the region face is "visually different" from the default face. >>> Can we do something like that? >> >> face-differs-from-default-p? > > Nice catch; IIUC display-supports-face-attributes-p is what is doing the > heavy work. > > Might need to be made smarter wrt :extend though? > Indeed... > > (set-face-background 'region (face-background 'default nil t)) > (face-differs-from-default-p 'region nil) > ; ⇒ :extend > ... although that's a really contrived example. I'm not sure it's TRT to add too much complexity there, so I would suggest to add an additional optional argument to face-differs-from-default-p, to exclude one or more attributes from the comparison (in this case :extend, but someone else might be interested in excluding other attributes in the future).