From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/82282 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.gnus.general Subject: Re: Summary line format and gnus-face-X Date: Fri, 07 Sep 2012 17:59:08 +0200 Message-ID: <85vcfphjs3.fsf@iznogoud.viz> References: <87d3393iud.fsf@thinkpad.tsdh.de> <87mx15ifog.fsf@gnus.org> <87pq612cuj.fsf@thinkpad.tsdh.de> <87sjawd3ak.fsf@gnus.org> <87r4qg1qmr.fsf@thinkpad.tsdh.de> <87d320783z.fsf@gnus.org> <85ipbruvaz.fsf@iznogoud.viz> <87ehmfi7ff.fsf@gnus.org> <85ehmfut5m.fsf@iznogoud.viz> <87y5kngqz0.fsf@gnus.org> <87harbj9wu.fsf@thinkpad.tsdh.de> <87392vngvl.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1347035876 4014 80.91.229.3 (7 Sep 2012 16:37:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2012 16:37:56 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M30549@lists.math.uh.edu Fri Sep 07 18:37:58 2012 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TA1Z8-0004Lx-41 for ding-account@gmane.org; Fri, 07 Sep 2012 18:37:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1TA1Y9-0006ny-PW; Fri, 07 Sep 2012 11:36:57 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TA1Y8-0006nm-2E for ding@lists.math.uh.edu; Fri, 07 Sep 2012 11:36:56 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TA1Y5-0003Rf-Dp for ding@lists.math.uh.edu; Fri, 07 Sep 2012 11:36:55 -0500 Original-Received: from mx19.lb01.inode.at ([62.99.145.21] helo=mx.inode.at) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1TA1Y3-0007Z7-Fz for ding@gnus.org; Fri, 07 Sep 2012 18:36:51 +0200 Original-Received: from [91.119.101.188] (port=13818 helo=iznogoud.viz) by smartmx-19.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1TA1Xy-0007G2-5u for ding@gnus.org; Fri, 07 Sep 2012 18:36:46 +0200 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.80 (FreeBSD)) (envelope-from ) id 1TA1Xw-0000nh-LI for ding@gnus.org; Fri, 07 Sep 2012 18:36:44 +0200 Mail-Followup-To: ding@gnus.org User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (berkeley-unix) X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:82282 Archived-At: On Thu, Sep 06 2012, Lars Ingebrigtsen wrote: > Tassilo Horn writes: > >> But now my separators in summary lines like the =E2=94=83 and the arrows= are >> colorized and boldified, too. >> >> R =E2=94=83 +=E2=94=83Lars Ingebrigtsen =E2=94=83 =E2=95=B0=E2=94= =80=E2=9D=AF >> >> 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." =20 ;; 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)))))))))) =20 (provide 'gnus-compat) =20 --=20 1.7.11.5