1 ;;; cc-ide.el --- C++ IDE
5 ;; Copyright (C) 2000 Stefan Bund
7 ;; cc-ide.el is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; cc-ide.el is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
28 (defun mail-add-header (header value &optional separator)
29 (when (and value (> (length value) 0))
30 (mail-position-on-field header)
32 (skip-chars-backward " \t\n\r")
33 (not (eq (preceding-char) ?:)))
37 (defun write-mail (&optional to subject cc bcc body attachment)
39 (loop for b in (buffer-list)
40 if (eq major-mode 'message-mode)
41 return (pop-to-buffer b)
43 (if (eq major-mode 'gnus-summary-mode)
44 (gnus-summary-mail-other-window)
46 (goto-char (point-max))
47 (if (re-search-backward "^-- $" nil)
50 (mail-add-header "To" to ",\n ")
51 (mail-add-header "Subject" subject "; ")
52 (mail-add-header "CC" cc ", ")
53 (mail-add-header "BCC" bcc ", "))
54 (if body (insert body))
55 ;; (when (file-readable-p "~/.signature")
57 ;; (insert-file "~/.signature")
58 ;; (goto-char (point-max))
61 (when (and attachment (> (length attachment) 0))
62 (if (and (> (length attachment) 5)
63 (string= (substring attachment 0 5) "file:"))
64 (setq attachment (substring attachment 5)))
65 (when (file-readable-p attachment)
67 (goto-char (point-max))
69 (mime-edit-insert-file attachment))))
70 (font-lock-fontify-buffer))