help-gnu-emacs
[Top][All Lists]
Advanced

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

Call function on expansion of to-address


From: Cecil Westerhof
Subject: Call function on expansion of to-address
Date: Tue, 04 May 2010 15:44:37 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

I have the following code in my .gnus:
    ;; Add formalities for me.
    (defadvice gnus-summary-reply (after formalities () activate)
      (dcbl-add-formalities t))

    (defun dcbl-add-formalities (&optional go-down)
      "Add the sender's first name to e-mail
    Based on code from Chris Ball 
(http://www.inference.phy.cam.ac.uk/cjb/dotfiles/dotgnus)"
      (interactive)
      (let ((address-comp)
            (first)
            (name)
            (to (message-fetch-field "To")))
        (when to
          (setq address-comp (mail-extract-address-components to))
          (setq name  (car address-comp))
          (setq first (or (and name (concat "" (car (split-string name)))) ""))
          (when (and first
                     (not (string= "" first)))
            (message-goto-body)
            (insert (concat (capitalize first) ",\n\n"))
            (when go-down
              (next-line 2)
              (move-beginning-of-line nil))))))

When I reply on a message my reply automatically starts with the first
name of the person I reply to. When writing a new e-mail I can call
dcbl-add-formalities to also get the first name as start of the message.
I was wondering: is there a way to get dcbl-add-formalities called at
the moment in the to-field an address is expanded?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

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