Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!mcvax!inria!shapiro From: shapiro@inria.UUCP (Marc Shapiro) Newsgroups: comp.emacs Subject: add/remove "FCC:" in mail header Message-ID: <564@inria.UUCP> Date: Mon, 26-Oct-87 10:39:35 EST Article-I.D.: inria.564 Posted: Mon Oct 26 10:39:35 1987 Date-Received: Thu, 29-Oct-87 01:36:07 EST Organization: INRIA, Rocquencourt. France Lines: 42 For GNU Emacs users. Here is a useful function for mail mode, mail-toggle-archive. It adds a mail archive line (FCC:) to the mail header if there is none, and removes it if it's there. I bind it to C-c C-o. (You should update the documentation string for mail-mode, too. It doesn't print \\{mail-mode-map} as it should.) ---- (cut here) -------------------------- (setq mail-mode-hook '(lambda () (define-key mail-mode-map "\C-c\C-o" 'mail-toggle-archive))) (defun mail-toggle-archive () "Remove (if present) or add (if absent) the mail archive file name, in a mail header. Variable ""mail-archive-file-name"" must be defined." (interactive) (save-excursion (beginning-of-buffer) (search-forward "\n--text follows this line--\n") (backward-char 1) (beginning-of-line) (let ((eoh (point))) (if (search-backward (concat "\nFCC: " mail-archive-file-name "\n") (point-min) t) (let ((bol (point))) (forward-char 1) (end-of-line) (delete-region bol (point))) (progn (goto-char eoh) (insert (concat "FCC: " mail-archive-file-name "\n"))))))) ----- (the end) ------------------------------- Marc Shapiro INRIA; B.P. 105; 78153 Le Chesnay Cedex; France; tel.: +33 (1) 39-63-53-25 e-mail: shapiro@inria.inria.fr; or: ...!mcvax!inria!shapiro