changeset 17512:50ada9a65e3d

(mail-attach-file): New function. (mail-mode-map): Add mail-attach-file on C-c C-i.
author Richard M. Stallman <rms@gnu.org>
date Sun, 20 Apr 1997 01:20:58 +0000
parents 10ead0052174
children ea3acb6b992a
files lisp/mail/sendmail.el
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/sendmail.el	Sat Apr 19 22:59:20 1997 +0000
+++ b/lisp/mail/sendmail.el	Sun Apr 20 01:20:58 1997 +0000
@@ -430,7 +430,8 @@
   (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 @@
 		   (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