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

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

Re: message-toggle-gcc


From: Joe Casadonte
Subject: Re: message-toggle-gcc
Date: Tue, 24 Aug 2004 13:50:23 -0400
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (windows-nt)

On Mon, 23 Aug 2004, Joe Casadonte wrote:

> On Sat, 14 Aug 2004, Emilio Lopes wrote:
>
>> Despite its name, it also needs Gnus.  I bind it to "C-c C-f C-g"
>> in `message-mode-map'.
>
> Great idea, Emilio!
>
> Here's a variation that:
>
> a) does not require gnus
> b) stores the previous value to be restored later

Tweaked a little to handle empty GCC fields (can now add it if it
didn't exist previously):


(make-variable-buffer-local
 (defvar message-save-gcc nil
   "Stores current value of GCC header - used with `message-toggle-gcc'."))



(defun message-toggle-gcc ()
  "Insert or remove the \"Gcc\" header.

Uses buffer-local variable `message-save-gcc' to store current Gcc:
value before removing it."
  (interactive)
  (save-excursion
        (let (gcc)
          (save-restriction
                (message-narrow-to-headers)
                (setq gcc (mail-fetch-field "Gcc")))
          (if gcc
                  (progn
                        (setq message-save-gcc gcc)
                        (message-remove-header "Gcc"))
                (message-position-on-field "Gcc" "Subject")
                (insert (or message-save-gcc "")))
                )))

--
Regards,

joe
Joe Casadonte
address@hidden

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
   Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
            Perl for Win32 => http://www.northbound-train.com/perlwin32.html
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------


reply via email to

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