bug-mailutils
[Top][All Lists]
Advanced

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

Re: [bug-mailutils] OT - RMAIL headers


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] OT - RMAIL headers
Date: Tue, 28 Sep 2010 21:14:36 +0300

Duke Normandin <address@hidden> ha escrit:

> 6 mos ago, I had decided to learn some CL (Allegro flavor). I gave it
> up because my wife booted me off her MacOS X machine, where I had it
> installed. I think that _a way better idea_ would be to learn elisp!
> ;)

All lisps have much in common, so the time you invested in learning CL
was not spent in vain.

> I've been looking for a way to add an attribution line to the replies
> I send. Something like what the MUA that I'm using at the moment
> (Alpine) does. E.g.
> 
> On Mon, 27 Sep 2010, Sergey Poznyakoff wrote:

A-ha... Then, perhaps, you could use the attached function as
a starting point. Add it to your .emacs and set:

(setq mail-citation-hook 'gray-mail-citation)

Then try C-c C-y in your reply buffer.  The output format is not exactly
the one you need, but you can easily improve it.

Regards,
Sergey

(defun gray-mail-citation ()
  (save-excursion
    (beginning-of-line)
    (let ((start (point))
          (sender nil)
          (date nil))
      (while (and (not (eobp))
                  (not (looking-at "^$")))
        (cond
         ((looking-at "^From:[ \t]*\\(.*\\)")
          (setq sender (buffer-substring (match-beginning 1) (match-end 1))))
         ((looking-at "^Date:[ \t]*\\(.*\\)")
          (setq date (buffer-substring (match-beginning 1) (match-end 1)))))
          
        (forward-line 1))
      (delete-region start (point))
      (if sender
          (insert "On " date " " sender " wrote:\n")))

    (set-marker (make-marker) (point))
    (end-of-buffer)
    (mail-indent-citation)))

reply via email to

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