Gnus development mailing list
 help / color / mirror / Atom feed
From: pmlists@free.fr (Peter Münster)
To: ding@gnus.org
Subject: special face for marks (was: setting face in gnus-user-format-function-x)
Date: Mon, 18 Jul 2011 23:09:20 +0200	[thread overview]
Message-ID: <87sjq3xpmn.fsf@micropit.couberia.bzh> (raw)
In-Reply-To: <m3y61o3vr5.fsf@quimbies.gnus.org>

On Mon, May 30 2011, Lars Magne Ingebrigtsen wrote:

> pmlists@free.fr (Peter Münster) writes:
>
>> I would like to set different faces for some marks in the summary lines.
>> But unfortunately, when changing the mark, the mark-letter is updated,
>> but the face is not. Only after reopening the group, the faces get
>> right.
>
> I think your best bet would be to put a function into
> `gnus-summary-update-hook', possibly calling
> `gnus-summary-update-article-line' to delete the line and reinsert it.

Unfortunately, there were too many side effects, when calling
gnus-summary-update-article-line:
- %P (line number) broken
- %B (thread symbols) vanished
- strange behaviour when dummy-lines are present
- perhaps more...

But today I've found a solution, that works quite well. Perhaps you
could add something like that to Gnus.
My motivation: various faces for different states are nice, but when the
faces are set for the whole lines, it can disturb the eyes. Setting the
face just for the mark can look better. Pine/Alpine does it like that,
and I liked it.

So, here the solution, that works for me:

--8<---------------cut here---------------start------------->8---
(setq gnus-summary-highlight-mark
      '(gnus-ticked-mark        gnus-ticked-mark-face
        gnus-unseen-mark        gnus-new-mark-face
        gnus-unread-mark        gnus-new-mark-face
        gnus-read-mark          gnus-read-mark-face
        gnus-killed-mark        gnus-del-mark-face
        gnus-expirable-mark     gnus-del-mark-face
        gnus-replied-mark       gnus-replied-mark-face
        gnus-forwarded-mark     gnus-replied-mark-face
        gnus-recent-mark        gnus-new-mark-face
        gnus-ancient-mark       gnus-read-mark-face
        gnus-dormant-mark       gnus-ticked-mark-face))

(defun my-mark-face (chr)
  (let ((face 'gnus-unknown-mark-face)
        (list gnus-summary-highlight-mark))
    (while list
      (if (equal (symbol-value (car list)) chr)
          (setq face (cadr list)
                list nil)
        (setq list (cddr list))))
    face))

(defun my-summary-update ()
  (save-excursion
    (beginning-of-line) ; because here is the mark!
    (let* ((inhibit-read-only t)
           (pt (point))
           (chr (char-after pt)))
      (put-text-property pt (1+ pt)
                         'face (my-mark-face chr)))))

(add-hook 'gnus-summary-update-hook 'my-summary-update)
--8<---------------cut here---------------end--------------->8---

-- 
           Peter




  parent reply	other threads:[~2011-07-18 21:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 18:04 setting face in gnus-user-format-function-x Peter Münster
2011-05-24  6:18 ` Reiner Steib
2011-05-25 13:38   ` Peter Münster
2011-05-26  6:37     ` Reiner Steib
2011-05-27  8:26       ` Peter Münster
2011-05-27  9:44         ` Michael Piotrowski
2011-05-30 18:10 ` Lars Magne Ingebrigtsen
2011-05-31  7:06   ` Peter Münster
2011-06-07 16:24     ` Michael Piotrowski
2011-06-23  8:47       ` Peter Münster
2011-06-26 10:06         ` Lars Magne Ingebrigtsen
2011-06-27 12:46           ` Peter Münster
2011-06-30  2:23             ` Lars Magne Ingebrigtsen
2011-06-30  5:14               ` Peter Münster
2011-06-30 22:03                 ` Lars Magne Ingebrigtsen
2011-07-13  9:15                   ` setting face in gnus-user-format-function-x (solved) Peter Münster
2011-07-13 11:35                     ` Peter Münster
2011-07-14  8:12                     ` Peter Münster
2011-07-14 19:09                       ` Reiner Steib
2011-07-11 16:57         ` setting face in gnus-user-format-function-x Michael Piotrowski
2011-07-13  7:36           ` Peter Münster
2011-07-18 21:09   ` Peter Münster [this message]
2011-07-19 10:09     ` special face for marks lee
2011-07-19 10:58       ` Peter Münster
2011-07-19 17:51         ` lee
2011-09-29  9:41           ` Ted Zlatanov

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

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

  git send-email \
    --in-reply-to=87sjq3xpmn.fsf@micropit.couberia.bzh \
    --to=pmlists@free.fr \
    --cc=ding@gnus.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 NNTP newsgroup(s).