annotate lisp/mail/mailclient.el @ 104626:caa79498564a

* subr.el (default-mode-line-format, default-header-line-format) (default-line-spacing, default-abbrev-mode, default-ctl-arrow) (default-direction-reversed, default-truncate-lines) (default-left-margin, default-tab-width, default-case-fold-search) (default-left-margin-width, default-right-margin-width) (default-left-fringe-width, default-right-fringe-width) (default-fringes-outside-margins, default-scroll-bar-width) (default-vertical-scroll-bar, default-indicate-empty-lines) (default-indicate-buffer-boundaries, default-fringe-indicator-alist) (default-fringe-cursor-alist, default-scroll-up-aggressively) (default-scroll-down-aggressively, default-fill-column) (default-cursor-type, default-buffer-file-type) (default-cursor-in-non-selected-windows) (default-buffer-file-coding-system, default-major-mode) (default-enable-multibyte-characters): Mark as obsolete. * cus-start.el (default-major-mode): Customize `major-mode' instead. (enable-multibyte-characters): Not customizable any more.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 27 Aug 2009 04:24:00 +0000
parents bc30507da7f8
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; mailclient.el --- mail sending via system's mail client. -*- byte-compile-dynamic: t -*-
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94674
diff changeset
3 ;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: David Reitter <david.reitter@gmail.com>
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keywords: mail
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79712
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79712
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79712
diff changeset
13 ;; (at your option) any later version.
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79712
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;;; Commentary:
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
25 ;; This package allows to hand over a buffer to be sent off
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
26 ;; via the system's designated e-mail client.
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; Note that the e-mail client will display the contents of the buffer
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; again for editing.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; The e-mail client is taken to be whoever handles a mailto: URL
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
30 ;; via `browse-url'.
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; Mailto: URLs are composed according to RFC2368.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; MIME bodies are not supported - we rather expect the mail client
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; to encode the body and add, for example, a digital signature.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; The mailto URL RFC calls for "short text messages that are
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
36 ;; actually the content of automatic processing."
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; So mailclient.el is ideal for situations where an e-mail is
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
38 ;; generated automatically, and the user can edit it in the
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
39 ;; mail client (e.g. bug-reports).
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; To activate:
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; (setq send-mail-function 'mailclient-send-it) ; if you use `mail'
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;;; Code:
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 (require 'sendmail) ;; for mail-sendmail-undelimit-header
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 (require 'mail-utils) ;; for mail-fetch-field
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
50 (defcustom mailclient-place-body-on-clipboard-flag
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 (fboundp 'w32-set-clipboard-data)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 "If non-nil, put the e-mail body on the clipboard in mailclient.
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
53 This is useful on systems where only short mailto:// URLs are
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
54 supported. Defaults to non-nil on Windows, nil otherwise."
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 :type 'boolean
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 :group 'mail)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (defun mailclient-encode-string-as-url (string)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 "Convert STRING to a URL, using utf-8 as encoding."
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 (apply (function concat)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (mapcar
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (lambda (char)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (cond
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ((eq char ?\x20) "%20") ;; space
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
65 ((eq char ?\n) "%0D%0A") ;; newline
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ((string-match "[-a-zA-Z0-9_:/.@]" (char-to-string char))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (char-to-string char)) ;; printable
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (t ;; everything else
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (format "%%%02x" char)))) ;; escape
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; Convert string to list of chars
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (append (encode-coding-string string 'utf-8)))))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 (defvar mailclient-delim-static "?")
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (defun mailclient-url-delim ()
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (let ((current mailclient-delim-static))
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
76 (setq mailclient-delim-static "&")
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 current))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (defun mailclient-gather-addresses (str &optional drop-first-name)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (let ((field (mail-fetch-field str nil t)))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (if field
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (save-excursion
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
83 (let ((first t)
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (result ""))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (mapc
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (lambda (recp)
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
87 (setq result
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
88 (concat
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 result
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (if (and drop-first-name
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 first)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ""
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (concat (mailclient-url-delim) str "="))
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
94 (mailclient-encode-string-as-url
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 recp)))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (setq first nil))
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
97 (split-string
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (mail-strip-quoted-names field) "\, *"))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 result)))))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
102257
4b59c52d2e8e mailclient.el: declare clipboard-kill-ring-save
David Reitter <david.reitter@gmail.com>
parents: 100908
diff changeset
101 (declare-function clipboard-kill-ring-save "menu-bar.el" (beg end))
4b59c52d2e8e mailclient.el: declare clipboard-kill-ring-save
David Reitter <david.reitter@gmail.com>
parents: 100908
diff changeset
102
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;;;###autoload
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
104 (defun mailclient-send-it ()
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 "Pass current buffer on to the system's mail client.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 Suitable value for `send-mail-function'.
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 The mail client is taken to be the handler of mailto URLs."
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (require 'mail-utils)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (let ((case-fold-search nil)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 delimline
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (mailbuf (current-buffer)))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (unwind-protect
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (with-temp-buffer
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (insert-buffer-substring mailbuf)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;; Move to header delimiter
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (mail-sendmail-undelimit-header)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (setq delimline (point-marker))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (if mail-aliases
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (expand-mail-aliases (point-min) delimline))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (goto-char (point-min))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;; ignore any blank lines in the header
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (while (and (re-search-forward "\n\n\n*" delimline t)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (< (point) delimline))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (replace-match "\n"))
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
125 (let ((case-fold-search t))
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; initialize limiter
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (setq mailclient-delim-static "?")
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; construct and call up mailto URL
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
129 (browse-url
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
130 (concat
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (save-excursion
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (narrow-to-region (point-min) delimline)
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
133 (concat
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 "mailto:"
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;; some of the headers according to RFC822
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
136 (mailclient-gather-addresses "To"
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
137 'drop-first-name)
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (mailclient-gather-addresses "cc" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (mailclient-gather-addresses "bcc" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (mailclient-gather-addresses "Resent-To" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (mailclient-gather-addresses "Resent-cc" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (mailclient-gather-addresses "Resent-bcc" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (mailclient-gather-addresses "Reply-To" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;; The From field is not honored for now: it's
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 ;; not necessarily configured. The mail client
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 ;; knows the user's address(es)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 ;; (mailclient-gather-addresses "From" )
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ;; subject line
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (let ((subj (mail-fetch-field "Subject" nil t)))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (widen) ;; so we can read the body later on
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (if subj ;; if non-blank
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;; the mail client will deal with
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;; warning the user etc.
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
154 (concat (mailclient-url-delim) "subject="
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (mailclient-encode-string-as-url subj))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ""))))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 ;; body
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
158 (concat
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
159 (mailclient-url-delim) "body="
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (mailclient-encode-string-as-url
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (if mailclient-place-body-on-clipboard-flag
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (progn
68565
877f39b663ef (mailclient-place-body-on-clipboard-flag): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 65685
diff changeset
163 (clipboard-kill-ring-save
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (+ 1 delimline) (point-max))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (concat
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 "*** E-Mail body has been placed on clipboard, "
103994
bc30507da7f8 (mailclient-send-it): Fix message.
Glenn Morris <rgm@gnu.org>
parents: 102257
diff changeset
167 "please paste it here! ***"))
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;; else
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (buffer-substring (+ 1 delimline) (point-max))))))))))))
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (provide 'mailclient)
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172
65685
fc5567e5329d Add arch tagline
Miles Bader <miles@gnu.org>
parents: 65664
diff changeset
173 ;; arch-tag: 35d10fc8-a1bc-4f29-a4e6-c288e53578ef
65664
3d928b5730c9 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ;;; mailclient.el ends here