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

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

Re: Overriding some face attributes without changing the default(s) one(


From: Alex Kost
Subject: Re: Overriding some face attributes without changing the default(s) one(s)
Date: Sun, 08 Jun 2014 10:02:56 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Alexandre LAURENT (2014-06-08 03:09 +0400) wrote:

> On Sat, Jun 7, 2014 at 8:52 PM, Michael Heerdegen
> <address@hidden> wrote:
>> Just configure the face to use the bold attribute, and leave all other
>> attributes emtpy.
>>
> Well, weird because that's exactly what I did but maybe not the right way.
> In my case, I configure this face in a theme like this:
>
> (custom-theme-set-faces
>  'monokai-nox
> ;; ...
> '(whitespace-line ((t (:weight bold))))
> ;; ...
> )
> If I open a C file, for each long line, the whole line still uses the
> default whitespace-line face + bold (which prevents the syntax
> highlighting)
>
>> What you want works well for me without doing anything special.  The
>> `whitespace-line' face is "merged" with the normal font locking, and I
>> see the colors from syntax highlighting, but in bold for long lines.
>>
> Good to know, I'm going to test with an empty emacs config + the
> configuration of the whitespace-line face.
>
>> I'm not completely sure if that works in older Emacs version.
> I'm using emacs 24.3.1 so this should work I suppose.

The problem is that in emacs 24.3.1 default face specifications are
merged with the face specifications defined by a theme, so what you see
is a "bold" defined by your theme and the bits from a default spec.  In
emacs 24.4 (and in the current trunk) your theme would work as expected:
if a face is themed, then the default spec is ignored completely.

If you want to make emacs 24.3.1 display only themed faces, you have to
override all the bits of the default spec in your theme (which sounds
horrible IMO), so for example the following should "free" your
background:

(custom-theme-set-faces
 'monokai-nox
;; ...
'(whitespace-line ((t (:background unspecified :weight bold))))
;; ...
)

If you are interested, I wrote something about that here:
<https://github.com/alezost/alect-themes/#emacs-2431-and-earlier>

Also there were some related bugs, for example:
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16658>

I hope it was helpful.

--
Alex Kost



reply via email to

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