diff options
| author | Richard M. Stallman | 1996-08-29 01:25:34 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-29 01:25:34 +0000 |
| commit | 5b6575b75deb35f9891fe45877fc39245aaaecc8 (patch) | |
| tree | 7ef85f9a5a32b2f33c02287fc2d128a008817e0e | |
| parent | f0490a0bf2ee3707994b6f62b6f9ad501b57099c (diff) | |
| download | emacs-5b6575b75deb35f9891fe45877fc39245aaaecc8.tar.gz emacs-5b6575b75deb35f9891fe45877fc39245aaaecc8.zip | |
(mail-mode-auto-fill): New function.
(mail-mode): Put it into normal-auto-fill-function.
| -rw-r--r-- | lisp/mail/sendmail.el | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 93c33c19b2d..42d52af460e 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -229,7 +229,7 @@ actually occur.") | |||
| 229 | 229 | ||
| 230 | (defvar mail-send-hook nil | 230 | (defvar mail-send-hook nil |
| 231 | "Normal hook run before sending mail, in Mail mode.") | 231 | "Normal hook run before sending mail, in Mail mode.") |
| 232 | 232 | ||
| 233 | (defun sendmail-sync-aliases () | 233 | (defun sendmail-sync-aliases () |
| 234 | (let ((modtime (nth 5 (file-attributes mail-personal-alias-file)))) | 234 | (let ((modtime (nth 5 (file-attributes mail-personal-alias-file)))) |
| 235 | (or (equal mail-alias-modtime modtime) | 235 | (or (equal mail-alias-modtime modtime) |
| @@ -299,7 +299,7 @@ actually occur.") | |||
| 299 | (or to subject in-reply-to | 299 | (or to subject in-reply-to |
| 300 | (set-buffer-modified-p nil)) | 300 | (set-buffer-modified-p nil)) |
| 301 | (run-hooks 'mail-setup-hook)) | 301 | (run-hooks 'mail-setup-hook)) |
| 302 | 302 | ||
| 303 | ;;;###autoload | 303 | ;;;###autoload |
| 304 | (defun mail-mode () | 304 | (defun mail-mode () |
| 305 | "Major mode for editing mail to be sent. | 305 | "Major mode for editing mail to be sent. |
| @@ -328,6 +328,8 @@ C-c C-v mail-sent-via (add a Sent-via field for each To or CC)." | |||
| 328 | (setq font-lock-defaults '(mail-font-lock-keywords t)) | 328 | (setq font-lock-defaults '(mail-font-lock-keywords t)) |
| 329 | (make-local-variable 'paragraph-separate) | 329 | (make-local-variable 'paragraph-separate) |
| 330 | (make-local-variable 'paragraph-start) | 330 | (make-local-variable 'paragraph-start) |
| 331 | (make-local-variable 'normal-auto-fill-function) | ||
| 332 | (setq normal-auto-fill-function 'mail-mode-auto-fill) | ||
| 331 | ;; `-- ' precedes the signature. `-----' appears at the start of the | 333 | ;; `-- ' precedes the signature. `-----' appears at the start of the |
| 332 | ;; lines that delimit forwarded messages. | 334 | ;; lines that delimit forwarded messages. |
| 333 | ;; Lines containing just >= 3 dashes, perhaps after whitespace, | 335 | ;; Lines containing just >= 3 dashes, perhaps after whitespace, |
| @@ -339,6 +341,25 @@ C-c C-v mail-sent-via (add a Sent-via field for each To or CC)." | |||
| 339 | "$\\|[ \t]*[-_][-_][-_]+$\\|-- $\\|-----\\|" | 341 | "$\\|[ \t]*[-_][-_][-_]+$\\|-- $\\|-----\\|" |
| 340 | paragraph-separate)) | 342 | paragraph-separate)) |
| 341 | (run-hooks 'text-mode-hook 'mail-mode-hook)) | 343 | (run-hooks 'text-mode-hook 'mail-mode-hook)) |
| 344 | |||
| 345 | (defun mail-mode-auto-fill () | ||
| 346 | "Carry out Auto Fill for Mail mode. | ||
| 347 | If within the headers, this makes the new lines into continuation lines." | ||
| 348 | (if (< (point) | ||
| 349 | (save-excursion | ||
| 350 | (goto-char (point-min)) | ||
| 351 | (if (search-forward mail-header-separator nil t) | ||
| 352 | (point) | ||
| 353 | 0))) | ||
| 354 | (let ((old-line-start (save-excursion (beginning-of-line) (point)))) | ||
| 355 | (if (do-auto-fill) | ||
| 356 | (save-excursion | ||
| 357 | (beginning-of-line) | ||
| 358 | (while (not (eq (point) old-line-start)) | ||
| 359 | (insert " ") | ||
| 360 | (forward-line -1)) | ||
| 361 | t))) | ||
| 362 | (do-auto-fill))) | ||
| 342 | 363 | ||
| 343 | ;;; Set up keymap. | 364 | ;;; Set up keymap. |
| 344 | 365 | ||
| @@ -409,6 +430,8 @@ C-c C-v mail-sent-via (add a Sent-via field for each To or CC)." | |||
| 409 | (define-key mail-mode-map [menu-bar headers to] | 430 | (define-key mail-mode-map [menu-bar headers to] |
| 410 | '("To" . mail-to)) | 431 | '("To" . mail-to)) |
| 411 | 432 | ||
| 433 | ;; User-level commands for sending. | ||
| 434 | |||
| 412 | (defun mail-send-and-exit (arg) | 435 | (defun mail-send-and-exit (arg) |
| 413 | "Send message like `mail-send', then, if no errors, exit from mail buffer. | 436 | "Send message like `mail-send', then, if no errors, exit from mail buffer. |
| 414 | Prefix arg means don't delete this window." | 437 | Prefix arg means don't delete this window." |
| @@ -477,6 +500,9 @@ the user from the mailer." | |||
| 477 | (progn | 500 | (progn |
| 478 | (set-buffer-modified-p nil) | 501 | (set-buffer-modified-p nil) |
| 479 | (delete-auto-save-file-if-necessary t)))))) | 502 | (delete-auto-save-file-if-necessary t)))))) |
| 503 | |||
| 504 | ;; This does the real work of sending a message via sendmail. | ||
| 505 | ;; It is called via the variable send-mail-function. | ||
| 480 | 506 | ||
| 481 | (defun sendmail-send-it () | 507 | (defun sendmail-send-it () |
| 482 | (require 'mail-utils) | 508 | (require 'mail-utils) |