Include date and time of original message in quoted reply using emacs and gnus

emacs, gnus

Solution

actually gnus provides formatted function for you.

(setq message-citation-line-function 'message-insert-formatted-citation-line)
(setq message-citation-line-format "On %a, %b %d %Y, %f wrote:\n")

change the varible according to your taste.. `format-time-string' has options list

Less lines in .emacs :)

Problem

When I use one of the `*-with-original` functions to reply to a message using `gnus` (`message`) in emacs, I get a quotation similar to this: ``` "Doe, John" <johndoe@example.com> writes: > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. > Consectetuer adipiscing elit. Lorem ipsum dolor sit > amet, consectetuer adipiscing elit. ``` I would like gnus to behave like other MUAs that include the date and time of the original message, something like: ``` On Thu 11 October 2012 09:20:12 "Doe, John" <johndoe@example.com> wrote: > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. > Consectetuer adipiscing elit. Lorem ipsum dolor sit > amet, consectetuer adipiscing elit. ``` Is there any way to change the style of quotation to accomplish this? Update 2: I'm now using an even simpler solution, from kindahero's answer: ``` (setq message-citation-line-function 'message-insert-formatted-citation-line) (setq message-citation-line-format "On %a, %b %d %Y at %r, %f wrote:") ``` Update 1: I ended up with the following solution, based on perh's answer: ``` (defun my-citation-line () "Inserts name, email, and date" (when message-reply-headers (insert "On " (format-time-string "%a, %b %e, %Y at %r" (date-to-time (mail-header-date message-reply-headers))) ", " (or (gnus-extract-address-component-name (mail-header-from message-reply-headers)) "Somebody") (format " <%s>" (or (gnus-extract-address-component-email (mail-header-from message-reply-headers)) "somebody@example.com")) " wrote:\n"))) (setq message-citation-line-function 'my-citation-line) ``` The end result looks like this: ``` On Fri, Oct 12, 2012 at 03:11:48 PM, John Doe <johndoe@example.com> wrote: ```

Original source