Gnus development mailing list
 help / color / mirror / Atom feed
From: "Zhao\, Gang" <gamerh2o@gmail.com>
To: ding@gnus.org
Cc: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: Re: time format on message citation line
Date: Thu, 03 Apr 2014 19:25:15 +0800	[thread overview]
Message-ID: <87ioqq3bac.fsf@gmail.com> (raw)
In-Reply-To: <b4mha6bvvmu.fsf@jpl.org> (Katsumi Yamaoka's message of "Thu, 03 Apr 2014 14:18:17 +0900")

Hi,
On Thu, 2014-04-03 at 14:18:17 +0900, Katsumi Yamaoka wrote:
> On Wed, 2014-04-02 at 12:00:19 +0800, Zhao, Gang wrote:
>> I use a custom message citation line which includes the time when the
>> author post his mail. I want the time showed in message citation
>> line be the original author's timezone, not mine.
>
>> For example, if the author's timezone is +0200, the citation line's time
>> will show in that timezone. In my current setting the time is always
>> displayed as my own timezone, i.e., +0800.
>
>> My message-citation-line-format setting is "On %a, %Y-%m-%d at %T %z, %N wrote:"
>
>> Please add me to CC, not subscribed.
>
> A hack is below.  Since manipulating timezone is not so easy,
> probably we will have to do it in a similar way if we add this
> feature to the Gnus code.

This really works, as showed in above citation line :) Thanks for your help.

>
> (defadvice message-insert-formatted-citation-line
>     (around use-original-timezone (&optional from date) activate)
>   "Use the original author's timezone in the citation line."
>   (if (and message-reply-headers
> 	   (not date)
> 	   (string-match "%z" message-citation-line-format))
>       (let* ((st (match-beginning 0))
> 	     (nd (match-end 0))
> 	     (message-citation-line-format message-citation-line-format)
> 	     (sent (mail-header-date message-reply-headers))
> 	     (time (progn
> 		     (require 'gnus-util)
> 		     (gnus-date-get-time sent)))
> 	     (tz (nth 8 (parse-time-string sent)))
> 	     (lsd (- (cadr time) (car (current-time-zone)) (- tz)))
> 	     (msd (car time)))
> 	(cond ((< lsd 0)
> 	       (setq msd (1- msd)
> 		     lsd (+ lsd 65536)))
> 	      ((>= lsd 65536)
> 	       (setq msd (1+ msd)
> 		     lsd (- lsd 65536))))
> 	(setq message-citation-line-format
> 	      (concat (substring message-citation-line-format 0 st)
> 		      (format "%s%02d00"
> 			      (if (>= tz 0) "+" "-")
> 			      (abs (/ tz 3600)))
> 		      (substring message-citation-line-format nd)))
> 	(setq date (list msd lsd))
> 	ad-do-it)
>     ad-do-it))



  reply	other threads:[~2014-04-03 11:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02  4:00 Zhao, Gang
2014-04-03  5:18 ` Katsumi Yamaoka
2014-04-03 11:25   ` Zhao, Gang [this message]
2014-04-10 11:06     ` format-time-string (was Re: time format on message citation line) Katsumi Yamaoka
2014-04-10 16:50       ` Andreas Schwab
2014-04-10 17:57         ` Eric S Fraga
2014-04-10 23:34           ` Katsumi Yamaoka
2014-04-11  8:14             ` Eric S Fraga
2014-04-11  9:31               ` Katsumi Yamaoka
2014-04-11 13:21                 ` Eric S Fraga
2014-04-19 21:22       ` Adam Sjøgren
2014-04-20 23:19         ` Katsumi Yamaoka
2014-04-15 23:34     ` time format on message citation line Katsumi Yamaoka
2014-04-16  9:28       ` Zhao, Gang

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=87ioqq3bac.fsf@gmail.com \
    --to=gamerh2o@gmail.com \
    --cc=ding@gnus.org \
    --cc=yamaoka@jpl.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).