From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/84414 Path: news.gmane.org!not-for-mail From: "Zhao\, Gang" Newsgroups: gmane.emacs.gnus.general Subject: Re: time format on message citation line Date: Thu, 03 Apr 2014 19:25:15 +0800 Message-ID: <87ioqq3bac.fsf@gmail.com> References: <87a9c4cre4.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1396527399 23974 80.91.229.3 (3 Apr 2014 12:16:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Apr 2014 12:16:39 +0000 (UTC) Cc: Katsumi Yamaoka To: ding@gnus.org Original-X-From: ding-owner+M32661@lists.math.uh.edu Thu Apr 03 14:16:32 2014 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 1WVfmq-0000Fc-0I for ding-account@gmane.org; Thu, 03 Apr 2014 13:26:24 +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 1WVfm2-0003x5-0Z; Thu, 03 Apr 2014 06:25:34 -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 1WVfm0-0003wv-AC for ding@lists.math.uh.edu; Thu, 03 Apr 2014 06:25:32 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1WVfly-000657-Np for ding@lists.math.uh.edu; Thu, 03 Apr 2014 06:25:32 -0500 Original-Received: from mail-pd0-f171.google.com ([209.85.192.171]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1WVflx-0006mR-5d for ding@gnus.org; Thu, 03 Apr 2014 13:25:29 +0200 Original-Received: by mail-pd0-f171.google.com with SMTP id r10so1643622pdi.16 for ; Thu, 03 Apr 2014 04:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=xobKvH+qCMMBoHuS6JAMHyGoQUcSqZrpBj8Sg+WVjpw=; b=L9fXjhN1vQpmAt+mM7AaXxldutMRkjQ4wfpxhDb58HoBbaReq57bThLDZUGeCAK+8i yjvZR7z9EQSQA/U8x7FsZ+iYAfR4VRfUwB3nCFmTzaK0l7m/zUHa6/JFeEF3V0nTUOh4 8ZKAMViMENu/0twdiET7DKuyaPnzBO2IUXoKX4WEtYZK7CaliH7025NaPsqgvwI1pdMp Xe7/aWPQuBwo7aQ5X7pfSCPmPNiKkLEesHD+QcfebULq9F+kwwMrGoa+UsbjIATQfuxI AxGYwikYkb6Zd1uexg3g8NBeTJLWzDPhm7X4d4fPBQ9iCO3NBOtNb6qyiDwGYXkZFybF /hyw== X-Received: by 10.68.163.197 with SMTP id yk5mr6649430pbb.57.1396524322461; Thu, 03 Apr 2014 04:25:22 -0700 (PDT) Original-Received: from will ([61.157.126.10]) by mx.google.com with ESMTPSA id gj9sm10607002pbc.7.2014.04.03.04.25.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Apr 2014 04:25:21 -0700 (PDT) In-Reply-To: (Katsumi Yamaoka's message of "Thu, 03 Apr 2014 14:18:17 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Spam-Score: -2.0 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:84414 Archived-At: 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))