From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79160 Path: news.gmane.org!not-for-mail From: pmlists@free.fr (Peter =?utf-8?Q?M=C3=BCnster?=) Newsgroups: gmane.emacs.gnus.general Subject: Re: setting face in gnus-user-format-function-x Date: Thu, 23 Jun 2011 10:47:36 +0200 Organization: Micropit Message-ID: <87hb7hdjdj.fsf@micropit.couberia.bzh> References: <87sjs5thro.fsf@micropit.couberia.bzh> <87hb8b8i2u.fsf@micropit.couberia.bzh> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1308818926 5603 80.91.229.12 (23 Jun 2011 08:48:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Jun 2011 08:48:46 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M27459@lists.math.uh.edu Thu Jun 23 10:48:43 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QZfac-0000ER-Id for ding-account@gmane.org; Thu, 23 Jun 2011 10:48:42 +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 1QZfa4-00032V-Le; Thu, 23 Jun 2011 03:48:08 -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 1QZfa3-00032L-1U for ding@lists.math.uh.edu; Thu, 23 Jun 2011 03:48:07 -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 1QZfZr-0002t5-1G for ding@lists.math.uh.edu; Thu, 23 Jun 2011 03:48:06 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1QZfZn-0001Ns-Fm for ding@gnus.org; Thu, 23 Jun 2011 10:47:51 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QZfZm-0008AO-Kz for ding@gnus.org; Thu, 23 Jun 2011 10:47:50 +0200 Original-Received: from arennes-651-1-243-89.w90-32.abo.wanadoo.fr ([90.32.230.89]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jun 2011 10:47:50 +0200 Original-Received: from pmlists by arennes-651-1-243-89.w90-32.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jun 2011 10:47:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: arennes-651-1-243-89.w90-32.abo.wanadoo.fr User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:8VaLh/6Ag52HMYUksxUt+h9goig= X-Spam-Score: -4.9 (----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79160 Archived-At: On Tue, Jun 07 2011, Michael Piotrowski wrote: > I just tried it. Using `gnus-summary-update-hook' works. For my > application--a different face for the date, depending on the age of the > message--I used the following two-step approach: > > 1. I have a user format function that adds a non-face property, roughly > something like this: > > (cond > ((= message-day today) > (put-text-property 0 10 'mxp-date 'today message-date)) > ((= message-day (1- today)) > (put-text-property 0 10 'mxp-date 'yesterday message-date)) > (t > (put-text-property 0 10 'mxp-date 'older message-date))) > > 2. I have a function that looks for this property (using > `gnus-find-text-property-region') and sets the desired face. This > function is called by `gnus-summary-update-hook'. > > Up to now, this approach seems to work nicely. Maybe you can adapt it > to your needs. Unfortunately no success... :( This is, what I have now: --8<---------------cut here---------------start------------->8--- (defun gnus-user-format-function-x (header) (let ((my-string (format "%c" gnus-tmp-unread))) (put-text-property 0 0 'my-test 'my-test my-string) my-string)) (defun my-summary-update () (dolist (region (gnus-find-text-property-region (point-min) (point-max) 'my-test)) (destructuring-bind (start end function) region (put-text-property start end 'face gnus-face-2) (put-text-property start end 'gnus-face t)))) (add-hook 'gnus-summary-update-hook 'my-summary-update) --8<---------------cut here---------------end--------------->8--- But the face is not set. I've also tried Lars' suggestion to use gnus-summary-update-article-line, but I don't know how to supply the 2 required arguments "article" and "header". So, any help would be appreciated! (sorry for my lack of elisp-experience) Greetings, -- Peter