From f0aef6bf09e972b2bb3a904f7b411efd3de1c2c2 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 20 Apr 1997 01:20:58 +0000 Subject: [PATCH] (mail-attach-file): New function. (mail-mode-map): Add mail-attach-file on C-c C-i. --- lisp/mail/sendmail.el | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 1748430e4fe..7444a79aa0e 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -430,7 +430,8 @@ If within the headers, this makes the new lines into continuation lines." (define-key mail-mode-map "\C-c\C-w" 'mail-signature) (define-key mail-mode-map "\C-c\C-v" 'mail-sent-via) (define-key mail-mode-map "\C-c\C-c" 'mail-send-and-exit) - (define-key mail-mode-map "\C-c\C-s" 'mail-send)) + (define-key mail-mode-map "\C-c\C-s" 'mail-send) + (define-key mail-mode-map "\C-c\C-i" 'mail-attach-file)) (define-key mail-mode-map [menu-bar mail] (cons "Mail" (make-sparse-keymap "Mail"))) @@ -1094,6 +1095,26 @@ and don't delete any header fields." (run-hooks 'mail-yank-hooks) (mail-indent-citation)))))))) +(defun mail-attach-file (&optional file) + "Insert a file at the end of the buffer, with separator lines around it." + (interactive "fAttach file: ") + (save-excursion + (goto-char (point-max)) + (or (bolp) (newline)) + (newline) + (let ((start (point)) + middle) + (insert (format "===File %s===" file)) + (insert-char ?= (max 0 (- 60 (current-column)))) + (newline) + (setq middle (point)) + (insert "============================================================\n") + (push-mark) + (goto-char middle) + (insert-file-contents file) + (or (bolp) (newline)) + (goto-char start)))) + ;; Put these last, to reduce chance of lossage from quitting in middle of loading the file. ;;;###autoload -- 2.39.5