From: Wolfgang Jenkner <wjenkner@inode.at>
To: ding@gnus.org
Subject: Re: Summary line format and gnus-face-X
Date: Fri, 07 Sep 2012 17:59:08 +0200 [thread overview]
Message-ID: <85vcfphjs3.fsf@iznogoud.viz> (raw)
In-Reply-To: <87392vngvl.fsf@gnus.org>
On Thu, Sep 06 2012, Lars Ingebrigtsen wrote:
> Tassilo Horn <tsdh@gnu.org> writes:
>
>> But now my separators in summary lines like the ┃ and the arrows are
>> colorized and boldified, too.
>>
>> R ┃ +┃Lars Ingebrigtsen ┃ ╰─❯ <Today, 16:34>
>>
>> For those I'd like to have a fixed face that doesn't change because of
>> score/readedness/age.
>
> Hm. That sounds difficult. :-)
What about something like the (barely tested) patch below? This would
make it possible to do things like
(progn
(fset 'gnus-put-text-property-excluding-characters-with-faces
(lambda (start end property value)
(add-face start end value)))
(defface foo
`((t (:weight normal :foreground ,(face-attribute 'default :foreground))))
"Foo face.")
(setq gnus-face-9 'foo)
(setq add-face-function
(lambda (face faces)
(when (eq (car faces) 'foo)
(cons 'foo (cons face (cdr faces))))))
(setq gnus-summary-line-format
"%U%R%z%I%(%[%4L: %-23,23f%]%) %9{*%} %s
"))
Subject: [PATCH] New variable add-face-function.
The value (if non-nil) is a function which computes how the faces
should be combined.
---
lisp/gnus-compat.el | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/lisp/gnus-compat.el b/lisp/gnus-compat.el
index 3241cd1..d829bbc 100644
--- a/lisp/gnus-compat.el
+++ b/lisp/gnus-compat.el
@@ -107,20 +107,34 @@ TRASH is ignored."
;; Emacs less than 24.3
(unless (fboundp 'add-face)
+ (defvar add-face-function nil
+ "The value may be a function which is passed a face and
+a list of faces and which should return something suitable as
+value of the `face' property. If it returns nil, however, or the
+value of `add-face-function' was nil to begin with, `add-face'
+will effectively just cons the face to the list of faces.")
+
(defun add-face (beg end face)
- "Combine FACE BEG and END."
+ "Combine FACE with the `face' text property values between BEG and END."
(let ((b beg))
(while (< b end)
(let ((oldval (get-text-property b 'face)))
(put-text-property
b (setq b (next-single-property-change b 'face nil end))
- 'face (cond ((null oldval)
- face)
- ((and (consp oldval)
- (not (keywordp (car oldval))))
- (cons face oldval))
- (t
- (list face oldval)))))))))
+ 'face (or (and add-face-function
+ (funcall add-face-function
+ face
+ (if (and (listp oldval)
+ (not (keywordp (car oldval))))
+ oldval
+ (list oldval))))
+ (cond ((null oldval)
+ face)
+ ((and (consp oldval)
+ (not (keywordp (car oldval))))
+ (cons face oldval))
+ (t
+ (list face oldval))))))))))
(provide 'gnus-compat)
--
1.7.11.5
next prev parent reply other threads:[~2012-09-07 15:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 6:31 Tassilo Horn
2012-09-04 22:30 ` Lars Ingebrigtsen
2012-09-05 6:38 ` Tassilo Horn
2012-09-05 13:09 ` Lars Ingebrigtsen
2012-09-05 13:27 ` Tassilo Horn
2012-09-05 16:22 ` Lars Ingebrigtsen
2012-09-05 17:10 ` Tassilo Horn
2012-09-06 13:31 ` Wolfgang Jenkner
2012-09-06 13:53 ` Lars Ingebrigtsen
2012-09-06 14:23 ` Wolfgang Jenkner
2012-09-06 14:34 ` Lars Ingebrigtsen
2012-09-06 14:58 ` Wolfgang Jenkner
2012-09-06 18:14 ` Tassilo Horn
2012-09-06 18:30 ` Lars Ingebrigtsen
2012-09-07 15:59 ` Wolfgang Jenkner [this message]
2012-09-08 9:41 ` Wolfgang Jenkner
2012-09-08 11:45 ` Wolfgang Jenkner
2012-09-08 12:37 ` Tassilo Horn
2012-09-09 13:13 ` Wolfgang Jenkner
2012-09-09 18:54 ` Lars Ingebrigtsen
2012-09-15 15:24 ` Wolfgang Jenkner
2012-09-06 14:36 ` Lars Ingebrigtsen
2012-09-06 14:51 ` Wolfgang Jenkner
2012-09-06 18:29 ` Lars Ingebrigtsen
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=85vcfphjs3.fsf@iznogoud.viz \
--to=wjenkner@inode.at \
--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).