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: Mon, 23 Aug 2004 11:29:00 -0400
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (windows-nt)

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

(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 (message-fetch-field "Gcc")))
          (if gcc
                  (progn
                        (setq message-save-gcc gcc)
                        (message-remove-header "Gcc"))
                (message-position-on-field "Gcc" "Subject")
                (insert message-save-gcc))
                )))

Tested briefly -- seems to work!

--
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]