unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alexandre LAURENT <shaoner@gmail.com>
To: Alex Kost <alezost@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Overriding some face attributes without changing the default(s) one(s)
Date: Mon, 9 Jun 2014 20:10:31 +0200	[thread overview]
Message-ID: <CAC8hHhm=vrN53aepZUAV_RxREzUPVyq61ANVnafU4vjjhtJKmg@mail.gmail.com> (raw)
In-Reply-To: <87lht6ha4m.fsf@gmail.com>

On Mon, Jun 9, 2014 at 8:26 AM, Alex Kost <alezost@gmail.com> wrote:
> 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.
Ok, I thought both issues were somehow related.
The thing is, I was not sure how to highlight these long lines anyway,
but I just cannot have a single face to handle this.

I sometimes have to read code from people who don't care about these
kind of rules (yes, they could even develop their project in a single
line (I suppose that they don't plan to read their own code)), so ~70%
of the file loses the syntax highlighting in this case.
For now, I'll just remove "lines" from "whitespace-style" and define
something like this:
(add-hook 'prog-mode-hook
 (lambda ()
(font-lock-add-keywords
nil
'(("^[^\n]\\{80\\}\\(.*\\)$"
;;...
)))))
It should be enough, and I can catch and highlight the end of the line only.

Anyway, thanks it is clear now and I didn't know about "C-4 C-x =".

-- 
Alexandre LAURENT



      reply	other threads:[~2014-06-09 18:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 11:32 Overriding some face attributes without changing the default(s) one(s) Alexandre LAURENT
2014-06-07  6:55 ` Alex Kost
2014-06-07 18:52 ` Michael Heerdegen
2014-06-07 23:09   ` Alexandre LAURENT
2014-06-08  6:02     ` Alex Kost
2014-06-08 20:23       ` Alexandre LAURENT
2014-06-09  6:26         ` Alex Kost
2014-06-09 18:10           ` Alexandre LAURENT [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC8hHhm=vrN53aepZUAV_RxREzUPVyq61ANVnafU4vjjhtJKmg@mail.gmail.com' \
    --to=shaoner@gmail.com \
    --cc=alezost@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).