Mercurial > emacs
annotate lisp/mail/sendmail.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | d4ea5385915f |
| children | bc25cbeb27c0 |
| rev | line source |
|---|---|
|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
604
diff
changeset
|
1 ;;; sendmail.el --- mail sending commands for Emacs. |
|
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
604
diff
changeset
|
2 |
|
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
825
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. |
|
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
825
diff
changeset
|
4 |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
779
diff
changeset
|
5 ;; Maintainer: FSF |
|
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
779
diff
changeset
|
7 |
| 455 | 8 ;; This file is part of GNU Emacs. |
| 9 | |
| 10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 11 ;; it under the terms of the GNU General Public License as published by | |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
779
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
| 455 | 13 ;; any later version. |
| 14 | |
| 15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 ;; GNU General Public License for more details. | |
| 19 | |
| 20 ;; You should have received a copy of the GNU General Public License | |
| 21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
| 22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 23 | |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
779
diff
changeset
|
24 ;;; Code: |
| 455 | 25 |
| 26 ;;;###autoload | |
|
1664
5345766220da
* sendmail.el (mail-self-blind, mail-interactive,
Jim Blandy <jimb@redhat.com>
parents:
1539
diff
changeset
|
27 (defvar mail-self-blind nil "\ |
| 455 | 28 Non-nil means insert BCC to self in messages to be sent. |
| 29 This is done when the message is initialized, | |
| 30 so you can remove or alter the BCC field to override the default.") | |
| 31 | |
| 32 ;;;###autoload | |
|
1664
5345766220da
* sendmail.el (mail-self-blind, mail-interactive,
Jim Blandy <jimb@redhat.com>
parents:
1539
diff
changeset
|
33 (defvar mail-interactive nil "\ |
| 455 | 34 Non-nil means when sending a message wait for and display errors. |
| 35 nil means let mailer mail back a message to report errors.") | |
| 36 | |
| 37 ;;;###autoload | |
|
1664
5345766220da
* sendmail.el (mail-self-blind, mail-interactive,
Jim Blandy <jimb@redhat.com>
parents:
1539
diff
changeset
|
38 (defvar mail-yank-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^remailed\\|^received:\\|^message-id:\\|^summary-line:\\|^to:\\|^subject:\\|^in-reply-to:\\|^return-path:" "\ |
| 455 | 39 Delete these headers from old message when it's inserted in a reply.") |
| 40 | |
| 41 ;; Useful to set in site-init.el | |
| 42 ;;;###autoload | |
| 43 (defconst send-mail-function 'sendmail-send-it "\ | |
| 44 Function to call to send the current buffer as mail. | |
| 1539 | 45 The headers are be delimited by a line which is `mail-header-separator'.") |
| 455 | 46 |
| 47 ;;;###autoload | |
| 48 (defvar mail-header-separator "--text follows this line--" "\ | |
| 49 *Line used to separate headers from text in messages being composed.") | |
| 50 | |
| 51 ;;;###autoload | |
| 52 (defvar mail-archive-file-name nil "\ | |
| 53 *Name of file to write all outgoing messages in, or nil for none. | |
| 54 Do not use an rmail file here! Instead, use its inbox file.") | |
| 55 | |
| 56 (defvar mail-default-reply-to nil | |
| 57 "*Address to insert as default Reply-to field of outgoing messages.") | |
| 58 | |
| 59 (defvar mail-alias-file nil | |
| 60 "*If non-nil, the name of a file to use instead of `/usr/lib/aliases'. | |
| 61 This file defines aliases to be expanded by the mailer; this is a different | |
| 62 feature from that of defining aliases in `.mailrc' to be expanded in Emacs. | |
| 63 This variable has no effect unless your system uses sendmail as its mailer.") | |
| 64 | |
|
1431
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
65 (defvar mail-aliases t |
|
1468
01e760e7de34
(mail-aliases): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
1431
diff
changeset
|
66 "Alist of mail address aliases, |
|
01e760e7de34
(mail-aliases): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
1431
diff
changeset
|
67 or t meaning should be initialized from `~/.mailrc'. |
|
01e760e7de34
(mail-aliases): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
1431
diff
changeset
|
68 The alias definitions in `~/.mailrc' have this form: |
|
01e760e7de34
(mail-aliases): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
1431
diff
changeset
|
69 alias ALIAS MEANING") |
|
1431
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
70 |
| 455 | 71 (defvar mail-yank-prefix nil |
| 72 "*Prefix insert on lines of yanked message being replied to. | |
| 73 nil means use indentation.") | |
| 74 | |
| 75 (defvar mail-abbrevs-loaded nil) | |
| 76 (defvar mail-mode-map nil) | |
| 77 | |
|
1431
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
78 (autoload 'build-mail-aliases "mailalias" |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
79 "Read mail aliases from `~/.mailrc' and set `mail-aliases'." |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
80 nil) |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
81 |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
82 (autoload 'expand-mail-aliases "mailalias" |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
83 "Expand all mail aliases in suitable header fields found between BEG and END. |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
84 Suitable header fields are `To', `Cc' and `Bcc' and their `Resent-' variants. |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
85 Optional second arg EXCLUDE may be a regular expression defining text to be |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
86 removed from alias expansions." |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
87 nil) |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
88 |
| 999 | 89 ;;;###autoload |
| 1025 | 90 (defvar mail-signature nil |
| 91 "*Text inserted at end of mail buffer when a message is initialized. | |
| 92 If t, it means to insert the contents of the file `~/.signature'.") | |
| 455 | 93 |
| 94 (defvar mail-reply-buffer nil) | |
| 95 (defvar mail-send-actions nil | |
| 96 "A list of actions to be performed upon successful sending of a message.") | |
| 97 | |
| 98 (defvar mail-default-headers nil | |
| 99 "*A string containing header lines, to be inserted in outgoing messages. | |
| 100 It is inserted before you edit the message, | |
| 101 so you can edit or delete these lines.") | |
| 102 | |
| 103 (defvar mail-mode-syntax-table nil | |
| 104 "Syntax table used while in mail mode.") | |
| 105 | |
| 106 (if (null mail-mode-syntax-table) | |
| 107 (progn | |
| 108 (setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) | |
| 109 (modify-syntax-entry ?% ". " mail-mode-syntax-table))) | |
| 110 | |
| 111 (defun mail-setup (to subject in-reply-to cc replybuffer actions) | |
|
1431
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
112 (if (eq mail-aliases t) |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
113 (progn |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
114 (setq mail-aliases nil) |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
115 (if (file-exists-p "~/.mailrc") |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
116 (build-mail-aliases)))) |
| 455 | 117 (setq mail-send-actions actions) |
| 118 (setq mail-reply-buffer replybuffer) | |
| 119 (goto-char (point-min)) | |
| 120 (insert "To: ") | |
| 121 (save-excursion | |
| 122 (if to | |
| 123 (progn | |
| 124 (insert to "\n") | |
| 125 ;;; Here removed code to extract names from within <...> | |
| 126 ;;; on the assumption that mail-strip-quoted-names | |
| 127 ;;; has been called and has done so. | |
| 128 (let ((fill-prefix "\t")) | |
| 129 (fill-region (point-min) (point-max)))) | |
| 130 (newline)) | |
| 131 (if cc | |
| 132 (let ((opos (point)) | |
| 133 (fill-prefix "\t")) | |
| 134 (insert "CC: " cc "\n") | |
| 135 (fill-region-as-paragraph opos (point-max)))) | |
| 136 (if in-reply-to | |
| 137 (insert "In-reply-to: " in-reply-to "\n")) | |
| 138 (insert "Subject: " (or subject "") "\n") | |
| 139 (if mail-default-headers | |
| 140 (insert mail-default-headers)) | |
| 141 (if mail-default-reply-to | |
| 142 (insert "Reply-to: " mail-default-reply-to "\n")) | |
| 143 (if mail-self-blind | |
| 144 (insert "BCC: " (user-login-name) "\n")) | |
| 145 (if mail-archive-file-name | |
| 146 (insert "FCC: " mail-archive-file-name "\n")) | |
|
1024
ceb4469d3cd7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
999
diff
changeset
|
147 (insert mail-header-separator "\n") |
| 1025 | 148 ;; Insert the signature. |
| 149 (cond ((eq mail-signature t) | |
| 150 (if (file-exists-p "~/.signature") | |
| 151 (progn | |
| 152 (insert "--\n") | |
| 153 (insert-file-contents "~/.signature")))) | |
| 154 (mail-signature | |
| 155 (insert mail-signature))) | |
| 455 | 156 (goto-char (point-max)) |
| 157 (or (bolp) (newline))) | |
| 158 (if to (goto-char (point-max))) | |
| 159 (or to subject in-reply-to | |
| 160 (set-buffer-modified-p nil)) | |
| 161 (run-hooks 'mail-setup-hook)) | |
| 162 | |
| 163 ;;;###autoload | |
| 164 (defun mail-mode () | |
| 165 "Major mode for editing mail to be sent. | |
| 166 Like Text Mode but with these additional commands: | |
| 167 C-c C-s mail-send (send the message) C-c C-c mail-send-and-exit | |
| 168 C-c C-f move to a header field (and create it if there isn't): | |
| 169 C-c C-f C-t move to To: C-c C-f C-s move to Subj: | |
| 170 C-c C-f C-b move to BCC: C-c C-f C-c move to CC: | |
| 171 C-c C-t move to message text. | |
| 172 C-c C-y mail-yank-original (insert current message, in Rmail). | |
| 173 C-c C-q mail-fill-yanked-message (fill what was yanked). | |
| 174 C-c C-v mail-sent-via (add a sent-via field for each To or CC)." | |
| 175 (interactive) | |
| 176 (kill-all-local-variables) | |
| 177 (make-local-variable 'mail-reply-buffer) | |
| 178 (setq mail-reply-buffer nil) | |
| 179 (make-local-variable 'mail-send-actions) | |
| 180 (set-syntax-table mail-mode-syntax-table) | |
| 181 (use-local-map mail-mode-map) | |
| 182 (setq local-abbrev-table text-mode-abbrev-table) | |
| 183 (setq major-mode 'mail-mode) | |
| 184 (setq mode-name "Mail") | |
| 185 (setq buffer-offer-save t) | |
| 186 (make-local-variable 'paragraph-separate) | |
| 187 (make-local-variable 'paragraph-start) | |
| 188 (setq paragraph-start (concat "^" mail-header-separator | |
| 189 "$\\|^[ \t]*[-_][-_][-_]+$\\|" | |
| 190 paragraph-start)) | |
| 191 (setq paragraph-separate (concat "^" mail-header-separator | |
| 192 "$\\|^[ \t]*[-_][-_][-_]+$\\|" | |
| 193 paragraph-separate)) | |
| 194 (run-hooks 'text-mode-hook 'mail-mode-hook)) | |
| 195 | |
| 196 (if mail-mode-map | |
| 197 nil | |
| 198 (setq mail-mode-map (nconc (make-sparse-keymap) text-mode-map)) | |
| 199 (define-key mail-mode-map "\C-c?" 'describe-mode) | |
| 200 (define-key mail-mode-map "\C-c\C-f\C-t" 'mail-to) | |
| 201 (define-key mail-mode-map "\C-c\C-f\C-b" 'mail-bcc) | |
| 573 | 202 (define-key mail-mode-map "\C-c\C-f\C-f" 'mail-fcc) |
| 455 | 203 (define-key mail-mode-map "\C-c\C-f\C-c" 'mail-cc) |
| 204 (define-key mail-mode-map "\C-c\C-f\C-s" 'mail-subject) | |
| 205 (define-key mail-mode-map "\C-c\C-t" 'mail-text) | |
| 206 (define-key mail-mode-map "\C-c\C-y" 'mail-yank-original) | |
| 207 (define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message) | |
| 208 (define-key mail-mode-map "\C-c\C-w" 'mail-signature) | |
| 209 (define-key mail-mode-map "\C-c\C-v" 'mail-sent-via) | |
| 210 (define-key mail-mode-map "\C-c\C-c" 'mail-send-and-exit) | |
| 211 (define-key mail-mode-map "\C-c\C-s" 'mail-send)) | |
| 212 | |
| 213 (defun mail-send-and-exit (arg) | |
| 1539 | 214 "Send message like `mail-send', then, if no errors, exit from mail buffer. |
| 455 | 215 Prefix arg means don't delete this window." |
| 216 (interactive "P") | |
| 217 (mail-send) | |
|
1269
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
218 (let ((newbuf (other-buffer (current-buffer)))) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
219 (bury-buffer (current-buffer)) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
220 (if (and (not arg) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
221 (not (one-window-p)) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
222 (save-excursion |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
223 (set-buffer (window-buffer (next-window (selected-window) 'not))) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
224 (eq major-mode 'rmail-mode))) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
225 (delete-window) |
|
d123cad4373c
(mail-send-and-exit): Do other-buffer before bury-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
1075
diff
changeset
|
226 (switch-to-buffer newbuf)))) |
| 455 | 227 |
| 228 (defun mail-send () | |
| 229 "Send the message in the current buffer. | |
| 230 If `mail-interactive' is non-nil, wait for success indication | |
| 231 or error messages, and inform user. | |
| 232 Otherwise any failure is reported in a message back to | |
| 233 the user from the mailer." | |
| 234 (interactive) | |
| 235 (if (or (buffer-modified-p) | |
| 236 (y-or-n-p "Message already sent; resend? ")) | |
| 237 (progn | |
| 238 (message "Sending...") | |
| 239 (run-hooks 'mail-send-hook) | |
| 240 (funcall send-mail-function) | |
| 241 ;; Now perform actions on successful sending. | |
| 242 (while mail-send-actions | |
| 243 (condition-case nil | |
| 244 (apply (car (car mail-send-actions)) (cdr (car mail-send-actions))) | |
| 245 (error)) | |
| 246 (setq mail-send-actions (cdr mail-send-actions))) | |
| 247 (set-buffer-modified-p nil) | |
| 248 (delete-auto-save-file-if-necessary t) | |
| 249 (message "Sending...done")))) | |
| 250 | |
| 251 (defun sendmail-send-it () | |
| 252 (let ((errbuf (if mail-interactive | |
| 253 (generate-new-buffer " sendmail errors") | |
| 254 0)) | |
| 255 (tembuf (generate-new-buffer " sendmail temp")) | |
| 256 (case-fold-search nil) | |
| 257 delimline | |
| 258 (mailbuf (current-buffer))) | |
| 259 (unwind-protect | |
| 260 (save-excursion | |
| 261 (set-buffer tembuf) | |
| 262 (erase-buffer) | |
| 263 (insert-buffer-substring mailbuf) | |
| 264 (goto-char (point-max)) | |
| 265 ;; require one newline at the end. | |
| 266 (or (= (preceding-char) ?\n) | |
| 267 (insert ?\n)) | |
| 268 ;; Change header-delimiter to be what sendmail expects. | |
| 269 (goto-char (point-min)) | |
| 270 (re-search-forward | |
| 271 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
| 272 (replace-match "\n") | |
| 273 (backward-char 1) | |
| 274 (setq delimline (point-marker)) | |
|
1431
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
275 (if mail-aliases |
|
240d5fe38595
(mail-setup): Call build-mail-aliases, not mail-abbrev-setup.
Richard M. Stallman <rms@gnu.org>
parents:
1269
diff
changeset
|
276 (expand-mail-aliases (point-min) delimline)) |
| 455 | 277 (goto-char (point-min)) |
| 278 ;; ignore any blank lines in the header | |
| 279 (while (and (re-search-forward "\n\n\n*" delimline t) | |
| 280 (< (point) delimline)) | |
| 281 (replace-match "\n")) | |
| 282 (let ((case-fold-search t)) | |
| 283 (goto-char (point-min)) | |
| 284 (if (re-search-forward "^Sender:" delimline t) | |
| 285 (error "Sender may not be specified.")) | |
| 286 ;; Find and handle any FCC fields. | |
| 287 (goto-char (point-min)) | |
| 288 (if (re-search-forward "^FCC:" delimline t) | |
| 289 (mail-do-fcc delimline)) | |
| 290 ;; If the From is different than current user, insert Sender. | |
| 291 (goto-char (point-min)) | |
| 292 (and (re-search-forward "^From:" delimline t) | |
| 293 (progn | |
| 294 (require 'mail-utils) | |
| 295 (not (string-equal | |
| 296 (mail-strip-quoted-names | |
| 297 (save-restriction | |
| 298 (narrow-to-region (point-min) delimline) | |
| 299 (mail-fetch-field "From"))) | |
| 300 (user-login-name)))) | |
| 301 (progn | |
| 302 (forward-line 1) | |
| 303 (insert "Sender: " (user-login-name) "\n"))) | |
| 304 ;; "S:" is an abbreviation for "Subject:". | |
| 305 (goto-char (point-min)) | |
| 306 (if (re-search-forward "^S:" delimline t) | |
| 307 (replace-match "Subject:")) | |
| 308 ;; Don't send out a blank subject line | |
| 309 (goto-char (point-min)) | |
| 310 (if (re-search-forward "^Subject:[ \t]*\n" delimline t) | |
| 311 (replace-match "")) | |
| 312 (if mail-interactive | |
| 313 (save-excursion | |
| 314 (set-buffer errbuf) | |
| 315 (erase-buffer)))) | |
| 316 (apply 'call-process-region | |
| 317 (append (list (point-min) (point-max) | |
| 318 (if (boundp 'sendmail-program) | |
| 319 sendmail-program | |
| 320 "/usr/lib/sendmail") | |
| 321 nil errbuf nil | |
| 322 "-oi" "-t") | |
| 323 ;; Always specify who from, | |
| 324 ;; since some systems have broken sendmails. | |
| 325 (list "-f" (user-login-name)) | |
| 326 ;;; ;; Don't say "from root" if running under su. | |
| 327 ;;; (and (equal (user-real-login-name) "root") | |
| 328 ;;; (list "-f" (user-login-name))) | |
| 329 (and mail-alias-file | |
| 330 (list (concat "-oA" mail-alias-file))) | |
| 331 ;; These mean "report errors by mail" | |
| 332 ;; and "deliver in background". | |
| 333 (if (null mail-interactive) '("-oem" "-odb")))) | |
| 334 (if mail-interactive | |
| 335 (save-excursion | |
| 336 (set-buffer errbuf) | |
| 337 (goto-char (point-min)) | |
| 338 (while (re-search-forward "\n\n* *" nil t) | |
| 339 (replace-match "; ")) | |
| 340 (if (not (zerop (buffer-size))) | |
| 341 (error "Sending...failed to %s" | |
| 342 (buffer-substring (point-min) (point-max))))))) | |
| 343 (kill-buffer tembuf) | |
| 344 (if (bufferp errbuf) | |
| 345 (kill-buffer errbuf))))) | |
| 346 | |
| 347 (defun mail-do-fcc (header-end) | |
| 348 (let (fcc-list | |
| 349 (rmailbuf (current-buffer)) | |
| 1075 | 350 timezone |
| 455 | 351 (tembuf (generate-new-buffer " rmail output")) |
| 352 (case-fold-search t)) | |
| 353 (save-excursion | |
| 354 (goto-char (point-min)) | |
| 355 (while (re-search-forward "^FCC:[ \t]*" header-end t) | |
| 356 (setq fcc-list (cons (buffer-substring (point) | |
| 357 (progn | |
| 358 (end-of-line) | |
| 359 (skip-chars-backward " \t") | |
| 360 (point))) | |
| 361 fcc-list)) | |
| 362 (delete-region (match-beginning 0) | |
| 363 (progn (forward-line 1) (point)))) | |
| 364 (set-buffer tembuf) | |
| 365 (erase-buffer) | |
| 1075 | 366 (call-process "date" nil t nil) |
| 367 (goto-char (point-min)) | |
| 368 (re-search-forward | |
| 369 "[0-9] \\([A-Za-z][A-Za-z ]*[A-Za-z]\\)[0-9 ]*$") | |
| 370 (setq timezone (buffer-substring (match-beginning 1) (match-end 1))) | |
| 371 (erase-buffer) | |
| 455 | 372 (insert "\nFrom " (user-login-name) " " |
| 373 (current-time-string) "\n") | |
| 1075 | 374 ;; Insert the time zone before the year. |
| 375 (forward-char -1) | |
| 376 (forward-word -1) | |
| 377 (insert timezone " ") | |
| 378 (goto-char (point-max)) | |
| 455 | 379 (insert-buffer-substring rmailbuf) |
| 380 ;; Make sure messages are separated. | |
| 381 (goto-char (point-max)) | |
| 382 (insert ?\n) | |
| 383 (goto-char 2) | |
| 384 ;; ``Quote'' "^From " as ">From " | |
| 385 ;; (note that this isn't really quoting, as there is no requirement | |
| 386 ;; that "^[>]+From " be quoted in the same transparent way.) | |
| 387 (let ((case-fold-search nil)) | |
| 388 (while (search-forward "\nFrom " nil t) | |
| 389 (forward-char -5) | |
| 390 (insert ?>))) | |
| 391 (while fcc-list | |
| 392 (let ((buffer (get-file-buffer (car fcc-list)))) | |
| 393 (if buffer | |
| 394 ;; File is present in a buffer => append to that buffer. | |
| 395 (let ((curbuf (current-buffer)) | |
| 396 (beg (point-min)) (end (point-max))) | |
| 397 (save-excursion | |
| 398 (set-buffer buffer) | |
| 399 ;; Keep the end of the accessible portion at the same place | |
| 400 ;; unless it is the end of the buffer. | |
| 401 (let ((max (if (/= (1+ (buffer-size)) (point-max)) | |
| 402 (point-max)))) | |
| 403 (unwind-protect | |
| 404 (progn | |
| 405 (narrow-to-region (point-min) (1+ (buffer-size))) | |
| 406 (goto-char (point-max)) | |
| 407 (if (eq major-mode 'rmail-mode) | |
| 408 ;; Append as a message to an RMAIL file | |
| 409 (let ((buffer-read-only nil)) | |
| 410 ;; This forces RMAIL's message counters to be | |
| 411 ;; recomputed when the next RMAIL operation is | |
| 412 ;; done on the buffer. | |
| 413 ;; See rmail-maybe-set-message-counters. | |
| 414 (setq rmail-total-messages nil) | |
| 415 (insert "\C-l\n0, unseen,,\n*** EOOH ***\n" | |
| 416 "From: " (user-login-name) "\n" | |
| 417 "Date: " (current-time-string) "\n") | |
| 418 (insert-buffer-substring curbuf beg end) | |
|
746
1b0748ff6f65
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
705
diff
changeset
|
419 (insert "\n\C-_") |
|
1b0748ff6f65
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
705
diff
changeset
|
420 (rmail-set-message-counters)) |
| 455 | 421 (insert-buffer-substring curbuf beg end))) |
| 422 (if max (narrow-to-region (point-min) max)))))) | |
| 423 ;; Else append to the file directly. | |
| 424 (write-region | |
| 425 ;; Include a blank line before if file already exists. | |
| 426 (if (file-exists-p (car fcc-list)) (point-min) (1+ (point-min))) | |
| 427 (point-max) (car fcc-list) t))) | |
| 428 (setq fcc-list (cdr fcc-list)))) | |
| 429 (kill-buffer tembuf))) | |
| 430 | |
| 431 (defun mail-sent-via () | |
| 432 "Make a Sent-via header line from each To or CC header line." | |
| 433 (interactive) | |
| 434 (save-excursion | |
| 435 (goto-char (point-min)) | |
| 436 ;; find the header-separator | |
| 437 (search-forward (concat "\n" mail-header-separator "\n")) | |
| 438 (forward-line -1) | |
| 439 ;; put a marker at the end of the header | |
| 440 (let ((end (point-marker)) | |
| 441 (case-fold-search t) | |
| 442 to-line) | |
| 443 (goto-char (point-min)) | |
| 444 ;; search for the To: lines and make Sent-via: lines from them | |
| 445 ;; search for the next To: line | |
| 446 (while (re-search-forward "^\\(to\\|cc\\):" end t) | |
| 447 ;; Grab this line plus all its continuations, sans the `to:'. | |
| 448 (let ((to-line | |
| 449 (buffer-substring (point) | |
| 450 (progn | |
| 451 (if (re-search-forward "^[^ \t\n]" end t) | |
| 452 (backward-char 1) | |
| 453 (goto-char end)) | |
| 454 (point))))) | |
| 455 ;; Insert a copy, with altered header field name. | |
| 456 (insert-before-markers "Sent-via:" to-line)))))) | |
| 457 | |
| 458 (defun mail-to () | |
| 459 "Move point to end of To-field." | |
| 460 (interactive) | |
| 461 (expand-abbrev) | |
| 462 (mail-position-on-field "To")) | |
| 463 | |
| 464 (defun mail-subject () | |
| 465 "Move point to end of Subject-field." | |
| 466 (interactive) | |
| 467 (expand-abbrev) | |
| 468 (mail-position-on-field "Subject")) | |
| 469 | |
| 470 (defun mail-cc () | |
| 471 "Move point to end of CC-field. Create a CC field if none." | |
| 472 (interactive) | |
| 473 (expand-abbrev) | |
| 474 (or (mail-position-on-field "cc" t) | |
| 475 (progn (mail-position-on-field "to") | |
| 476 (insert "\nCC: ")))) | |
| 477 | |
| 478 (defun mail-bcc () | |
| 479 "Move point to end of BCC-field. Create a BCC field if none." | |
| 480 (interactive) | |
| 481 (expand-abbrev) | |
| 482 (or (mail-position-on-field "bcc" t) | |
| 483 (progn (mail-position-on-field "to") | |
| 484 (insert "\nBCC: ")))) | |
| 485 | |
| 573 | 486 (defun mail-fcc () |
| 487 "Add a new FCC field, with file name completion." | |
| 488 (interactive) | |
| 489 (expand-abbrev) | |
| 490 (or (mail-position-on-field "fcc" t) ;Put new field after exiting FCC. | |
| 491 (mail-position-on-field "to")) | |
| 492 (insert "\nFCC: " (read-file-name "Folder carbon copy: "))) | |
| 493 | |
| 455 | 494 (defun mail-position-on-field (field &optional soft) |
| 495 (let (end | |
| 496 (case-fold-search t)) | |
| 497 (goto-char (point-min)) | |
| 604 | 498 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) |
| 455 | 499 (setq end (match-beginning 0)) |
| 500 (goto-char (point-min)) | |
| 501 (if (re-search-forward (concat "^" (regexp-quote field) ":") end t) | |
| 502 (progn | |
| 503 (re-search-forward "^[^ \t]" nil 'move) | |
| 504 (beginning-of-line) | |
| 505 (skip-chars-backward "\n") | |
| 506 t) | |
| 507 (or soft | |
| 508 (progn (goto-char end) | |
| 604 | 509 (insert field ": \n") |
| 510 (skip-chars-backward "\n"))) | |
| 455 | 511 nil))) |
| 512 | |
| 513 (defun mail-text () | |
| 514 "Move point to beginning of text field." | |
| 515 (interactive) | |
| 516 (goto-char (point-min)) | |
| 517 (search-forward (concat "\n" mail-header-separator "\n"))) | |
| 518 | |
|
679
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
519 (defun mail-signature (atpoint) |
| 1539 | 520 "Sign letter with contents of `mail-signature-file'." |
|
679
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
521 (interactive "P") |
| 455 | 522 (save-excursion |
|
679
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
523 (or atpoint |
|
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
524 (goto-char (point-max))) |
| 455 | 525 (skip-chars-backward " \t\n") |
| 526 (end-of-line) | |
|
679
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
527 (or atpoint |
|
046f1a6867e7
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
528 (delete-region (point) (point-max))) |
| 455 | 529 (insert "\n\n--\n") |
| 1025 | 530 (insert-file-contents (expand-file-name "~/.signature")))) |
| 455 | 531 |
| 532 (defun mail-fill-yanked-message (&optional justifyp) | |
| 533 "Fill the paragraphs of a message yanked into this one. | |
| 534 Numeric argument means justify as well." | |
| 535 (interactive "P") | |
| 536 (save-excursion | |
| 537 (goto-char (point-min)) | |
| 538 (search-forward (concat "\n" mail-header-separator "\n") nil t) | |
| 539 (fill-individual-paragraphs (point) | |
| 540 (point-max) | |
| 541 justifyp | |
| 542 t))) | |
| 543 | |
| 544 (defun mail-yank-original (arg) | |
| 545 "Insert the message being replied to, if any (in rmail). | |
| 546 Puts point before the text and mark after. | |
| 547 Normally, indents each nonblank line ARG spaces (default 3). | |
| 548 However, if `mail-yank-prefix' is non-nil, insert that prefix on each line. | |
| 549 | |
| 550 Just \\[universal-argument] as argument means don't indent, insert no prefix, | |
| 551 and don't delete any header fields." | |
| 552 (interactive "P") | |
| 553 (if mail-reply-buffer | |
| 554 (let ((start (point))) | |
| 555 (delete-windows-on mail-reply-buffer) | |
| 556 (insert-buffer mail-reply-buffer) | |
| 557 (if (consp arg) | |
| 558 nil | |
| 559 (mail-yank-clear-headers start (mark)) | |
| 560 (if (null mail-yank-prefix) | |
| 561 (indent-rigidly start (mark) | |
| 562 (if arg (prefix-numeric-value arg) 3)) | |
| 563 (save-excursion | |
| 564 (goto-char start) | |
| 565 (while (< (point) (mark)) | |
| 566 (insert mail-yank-prefix) | |
| 567 (forward-line 1))))) | |
| 568 (exchange-point-and-mark) | |
| 569 (if (not (eolp)) (insert ?\n))))) | |
| 570 | |
| 571 (defun mail-yank-clear-headers (start end) | |
| 572 (save-excursion | |
| 573 (goto-char start) | |
| 574 (if (search-forward "\n\n" end t) | |
| 575 (save-restriction | |
| 576 (narrow-to-region start (point)) | |
| 577 (goto-char start) | |
| 578 (while (let ((case-fold-search t)) | |
| 579 (re-search-forward mail-yank-ignored-headers nil t)) | |
| 580 (beginning-of-line) | |
| 581 (delete-region (point) | |
| 582 (progn (re-search-forward "\n[^ \t]") | |
| 583 (forward-char -1) | |
| 584 (point)))))))) | |
| 585 | |
| 586 ;; Put these last, to reduce chance of lossage from quitting in middle of loading the file. | |
| 587 | |
| 588 ;;;###autoload | |
| 589 (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions) | |
|
898
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
590 "Edit a message to be sent. Prefix arg means resume editing (don't erase). |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
591 When this function returns, the buffer `*mail*' is selected. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
592 The value is t if the message was newly initialized; otherwise, nil. |
| 455 | 593 |
| 1025 | 594 By default, the signature file `~/.signature' is inserted at the end; |
| 595 see the variable `mail-signature'. | |
| 455 | 596 |
| 597 \\<mail-mode-map> | |
| 598 While editing message, type \\[mail-send-and-exit] to send the message and exit. | |
| 599 | |
| 600 Various special commands starting with C-c are available in sendmail mode | |
| 601 to move to message header fields: | |
| 602 \\{mail-mode-map} | |
| 603 | |
| 604 If `mail-self-blind' is non-nil, a BCC to yourself is inserted | |
| 605 when the message is initialized. | |
| 606 | |
| 607 If `mail-default-reply-to' is non-nil, it should be an address (a string); | |
| 608 a Reply-to: field with that address is inserted. | |
| 609 | |
| 610 If `mail-archive-file-name' is non-nil, an FCC field with that file name | |
| 611 is inserted. | |
| 612 | |
| 613 If `mail-setup-hook' is bound, its value is called with no arguments | |
| 614 after the message is initialized. It can add more default fields. | |
| 615 | |
| 616 When calling from a program, the second through fifth arguments | |
| 617 TO, SUBJECT, IN-REPLY-TO and CC specify if non-nil | |
| 618 the initial contents of those header fields. | |
| 619 These arguments should not have final newlines. | |
| 620 The sixth argument REPLYBUFFER is a buffer whose contents | |
| 621 should be yanked if the user types C-c C-y. | |
| 622 The seventh argument ACTIONS is a list of actions to take | |
| 623 if/when the message is sent. Each action looks like (FUNCTION . ARGS); | |
| 624 when the message is sent, we apply FUNCTION to ARGS. | |
| 625 This is how Rmail arranges to mark messages `answered'." | |
| 626 (interactive "P") | |
|
898
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
627 ;;; This is commented out because I found it was confusing in practice. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
628 ;;; It is easy enough to rename *mail* by hand with rename-buffer |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
629 ;;; if you want to have multiple mail buffers. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
630 ;;; And then you can control which messages to save. --rms. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
631 ;;; (let ((index 1) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
632 ;;; buffer) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
633 ;;; ;; If requested, look for a mail buffer that is modified and go to it. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
634 ;;; (if noerase |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
635 ;;; (progn |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
636 ;;; (while (and (setq buffer |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
637 ;;; (get-buffer (if (= 1 index) "*mail*" |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
638 ;;; (format "*mail*<%d>" index)))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
639 ;;; (not (buffer-modified-p buffer))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
640 ;;; (setq index (1+ index))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
641 ;;; (if buffer (switch-to-buffer buffer) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
642 ;;; ;; If none exists, start a new message. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
643 ;;; ;; This will never re-use an existing unmodified mail buffer |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
644 ;;; ;; (since index is not 1 anymore). Perhaps it should. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
645 ;;; (setq noerase nil)))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
646 ;;; ;; Unless we found a modified message and are happy, start a new message. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
647 ;;; (if (not noerase) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
648 ;;; (progn |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
649 ;;; ;; Look for existing unmodified mail buffer. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
650 ;;; (while (and (setq buffer |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
651 ;;; (get-buffer (if (= 1 index) "*mail*" |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
652 ;;; (format "*mail*<%d>" index)))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
653 ;;; (buffer-modified-p buffer)) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
654 ;;; (setq index (1+ index))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
655 ;;; ;; If none, make a new one. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
656 ;;; (or buffer |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
657 ;;; (setq buffer (generate-new-buffer "*mail*"))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
658 ;;; ;; Go there and initialize it. |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
659 ;;; (switch-to-buffer buffer) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
660 ;;; (erase-buffer) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
661 ;;; (setq default-directory (expand-file-name "~/")) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
662 ;;; (auto-save-mode auto-save-default) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
663 ;;; (mail-mode) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
664 ;;; (mail-setup to subject in-reply-to cc replybuffer actions) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
665 ;;; (if (and buffer-auto-save-file-name |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
666 ;;; (file-exists-p buffer-auto-save-file-name)) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
667 ;;; (message "Auto save file for draft message exists; consider M-x mail-recover")) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
668 ;;; t)) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
669 (switch-to-buffer "*mail*") |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
670 (setq default-directory (expand-file-name "~/")) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
671 (auto-save-mode auto-save-default) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
672 (mail-mode) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
673 (let (initialized) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
674 (and (not noerase) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
675 (or (not (buffer-modified-p)) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
676 (y-or-n-p "Unsent message being composed; erase it? ")) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
677 (progn (erase-buffer) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
678 (mail-setup to subject in-reply-to cc replybuffer actions) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
679 (setq initialized t))) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
680 (if (and buffer-auto-save-file-name |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
681 (file-exists-p buffer-auto-save-file-name)) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
682 (message "Auto save file for draft message exists; consider M-x mail-recover")) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
683 initialized)) |
| 455 | 684 |
| 685 (defun mail-recover () | |
| 686 "Reread contents of current buffer from its last auto-save file." | |
| 687 (interactive) | |
| 688 (let ((file-name (make-auto-save-file-name))) | |
| 689 (cond ((save-window-excursion | |
| 690 (if (not (eq system-type 'vax-vms)) | |
| 691 (with-output-to-temp-buffer "*Directory*" | |
| 692 (buffer-disable-undo standard-output) | |
| 693 (call-process "ls" nil standard-output nil "-l" file-name))) | |
| 694 (yes-or-no-p (format "Recover auto save file %s? " file-name))) | |
| 695 (let ((buffer-read-only nil)) | |
| 696 (erase-buffer) | |
| 697 (insert-file-contents file-name nil))) | |
| 698 (t (error "mail-recover cancelled."))))) | |
| 699 | |
| 700 ;;;###autoload | |
| 701 (defun mail-other-window (&optional noerase to subject in-reply-to cc replybuffer sendactions) | |
| 702 "Like `mail' command, but display mail buffer in another window." | |
| 703 (interactive "P") | |
| 704 (let ((pop-up-windows t)) | |
| 705 (pop-to-buffer "*mail*")) | |
| 706 (mail noerase to subject in-reply-to cc replybuffer sendactions)) | |
| 707 | |
| 708 ;;;###autoload | |
| 779 | 709 (defun mail-other-frame (&optional noerase to subject in-reply-to cc replybuffer sendactions) |
| 710 "Like `mail' command, but display mail buffer in another frame." | |
| 455 | 711 (interactive "P") |
| 779 | 712 (let ((pop-up-frames t)) |
| 455 | 713 (pop-to-buffer "*mail*")) |
| 714 (mail noerase to subject in-reply-to cc replybuffer sendactions)) | |
| 715 | |
| 716 | |
| 717 ;;;###autoload | |
|
898
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
718 (define-key ctl-x-map "m" 'mail) |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
719 |
|
d3e136526f22
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
720 ;;;###autoload |
| 455 | 721 (define-key ctl-x-4-map "m" 'mail-other-window) |
| 722 | |
| 723 ;;;###autoload | |
| 779 | 724 (define-key ctl-x-5-map "m" 'mail-other-frame) |
| 455 | 725 |
| 726 | |
| 727 ;;; Do not add anything but external entries on this page. | |
| 584 | 728 |
| 729 (provide 'sendmail) | |
| 730 | |
|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
604
diff
changeset
|
731 ;;; sendmail.el ends here |
