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: Mon, 09 Jun 2014 10:26:01 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Alexandre LAURENT (2014-06-09 00:23 +0400) wrote:

> On Sun, Jun 8, 2014 at 8:02 AM, Alex Kost <alezost@gmail.com> wrote:
>>
>> 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
> Yes it is horrible, I wanted to avoid that.
>> background:
>>
>> (custom-theme-set-faces
>>  'monokai-nox
>> ;; ...
>> '(whitespace-line ((t (:background unspecified :weight bold))))
> Actually, setting the foreground to unspecified does not work either.
> I'm pretty sure it takes the "default" face and this face only, which
> is different from the multiple faces applied when opening a source
> file (no matter what that source file is).
> I also define this default face in both my themes.

Oh, now I understand what you want.  Actually here you faced with
another problem: when you enable whitespace-mode in emacs 24.3.1,
"whitespace-line" becomes the only active face in a long line, and in
emacs 24.4 it is added to the faces in that line.

So let's say, you have the following long line in a buffer with
"emacs-lisp-mode" (and "whitespace-mode" is enabled):

(defun some-function (arg1 arg2 &rest args) "A very useful function." 
(interactive) (message "Hello"))

If you move your cursor to the "defun" word and press "C-4 C-x =", in
the bottom of the "*Help*" buffer you will see:

There are text properties here:
  face                 whitespace-line
  fontified            t

I.e. only "whitespace-line" face is active and you can't see
"font-lock-keyword-face" (used for highlighting "defun") no matter how
you customized "whitespace-line".

As for emacs 24.4, you will see:

There are text properties here:
  face                 (whitespace-line font-lock-keyword-face)
  fontified            t

In this case if some bits of face spec are unspecified in
"whitespace-line" face, the ones from "font-lock-keyword-face" are used.

So that is not the same problem we were discussing before, but it is
also fixed in emacs 24.4.

>> ;; ...
>> )
>>
>> 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.
> Yes it is!
>
> Since I definitely need emacs24.4 for some other features/fix (ex: the
> rectangular region to be visually highlighted), I'll just wait for the
> package to be available on my distro.
>
> Thank you.




reply via email to

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