info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: howto define dynamic color with gnus-summary-line-format


From: haomiao
Subject: Re: howto define dynamic color with gnus-summary-line-format
Date: Tue, 19 Feb 2008 18:48:18 -0800 (PST)
User-agent: G2/1.0

Thank you.

> ,----
> | `u'
> |      User defined specifier.  The next character in the format string
> |      should be a letter.  Gnus will call the function
> |      `gnus-user-format-function-'`X', where `X' is the letter following
> |      `%u'.  The function will be passed a single dummy parameter as
> |      argument.  The function should return a string, which will be
> |      inserted into the buffer just like information from any other
> |      specifier.
> `----
>
> I guess you will have to write your own specifier so that it changes the
> face for the date in the summary line.
>
I tyied but failed, here is my .gnus.el:
----------------------------------
(copy-face 'default 'face-3)
(set-face-foreground 'face-3 "DeepSkyBlue1")
(setq gnus-face-3 'face-3)

(defun gnus-user-format-function-c (header)
   "Return a string like MM/DD from a Date header."
   (condition-case ()
      (format-time-string
         "%m/%d"
         (safe-date-to-time (mail-header-date header)))
      (error "  -   ")))

(defun gnus-user-format-function-z (header)
   "test dynamic color"
   (if  (string=
           (format-time-string "%m%d")
           (format-time-string
              "%m%d"
              (safe-date-to-time (mail-header-date header))))
      ;; then
      (set-face-foreground 'face-3 "red")
      ;; else
      (set-face-foreground 'face-3 "blue"))
   "")

(setq gnus-summary-line-format "%uz%U%R%z %3{%uc%}: %1{%B%-23,23n%} %s
\n")
-------------------------------------------------------------

It seemed that emacs only display the summary buffer after the last
call of gnus-user-format-function-z.
So the color is all the same.

Is there any advice?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]