diff options
| author | Stefan Monnier | 2001-10-27 22:19:29 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-27 22:19:29 +0000 |
| commit | f81b71c78b3286cfa1e21f57d7afc729236ba17d (patch) | |
| tree | de1b566a975ad50cdbf41043ccdf8c29bd8edcab | |
| parent | 64ade657fb1ffcf74fb0b5f9b01ec4c5bb655a60 (diff) | |
| download | emacs-f81b71c78b3286cfa1e21f57d7afc729236ba17d.tar.gz emacs-f81b71c78b3286cfa1e21f57d7afc729236ba17d.zip | |
(mail-mode-syntax-table): Let it inherit from text-mode-syntax-table.
(mail-mode): Use define-derived-mode.
Fix ordering of alternatives in adaptive-fill-regexp.
(mail-mode-map): Don't rely on keymap's internal representation.
| -rw-r--r-- | lisp/mail/sendmail.el | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 98f6639230b..384b89e6af9 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -324,13 +324,12 @@ for the recipient, who may not know how to decode them properly." | |||
| 324 | The value should be an expression to test whether the problem will | 324 | The value should be an expression to test whether the problem will |
| 325 | actually occur.") | 325 | actually occur.") |
| 326 | 326 | ||
| 327 | (defvar mail-mode-syntax-table nil | 327 | (defvar mail-mode-syntax-table |
| 328 | "Syntax table used while in mail mode.") | 328 | (let ((st (make-syntax-table))) |
| 329 | 329 | ;; define-derived-mode will make it inherit from text-mode-syntax-table. | |
| 330 | (if (not mail-mode-syntax-table) | 330 | (modify-syntax-entry ?% ". " st) |
| 331 | (progn | 331 | st) |
| 332 | (setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) | 332 | "Syntax table used while in `mail-mode'.") |
| 333 | (modify-syntax-entry ?% ". " mail-mode-syntax-table))) | ||
| 334 | 333 | ||
| 335 | (defvar mail-font-lock-keywords | 334 | (defvar mail-font-lock-keywords |
| 336 | (eval-when-compile | 335 | (eval-when-compile |
| @@ -456,7 +455,7 @@ actually occur.") | |||
| 456 | :options '(footnote-mode)) | 455 | :options '(footnote-mode)) |
| 457 | 456 | ||
| 458 | ;;;###autoload | 457 | ;;;###autoload |
| 459 | (defun mail-mode () | 458 | (define-derived-mode mail-mode text-mode "Mail" |
| 460 | "Major mode for editing mail to be sent. | 459 | "Major mode for editing mail to be sent. |
| 461 | Like Text Mode but with these additional commands: | 460 | Like Text Mode but with these additional commands: |
| 462 | \\[mail-send] mail-send (send the message) \\[mail-send-and-exit] mail-send-and-exit | 461 | \\[mail-send] mail-send (send the message) \\[mail-send-and-exit] mail-send-and-exit |
| @@ -471,15 +470,8 @@ Here are commands that move to a header field (and create it if there isn't): | |||
| 471 | \\[mail-sent-via] mail-sent-via (add a Sent-via field for each To or CC). | 470 | \\[mail-sent-via] mail-sent-via (add a Sent-via field for each To or CC). |
| 472 | Turning on Mail mode runs the normal hooks `text-mode-hook' and | 471 | Turning on Mail mode runs the normal hooks `text-mode-hook' and |
| 473 | `mail-mode-hook' (in that order)." | 472 | `mail-mode-hook' (in that order)." |
| 474 | (interactive) | ||
| 475 | (kill-all-local-variables) | ||
| 476 | (make-local-variable 'mail-reply-action) | 473 | (make-local-variable 'mail-reply-action) |
| 477 | (make-local-variable 'mail-send-actions) | 474 | (make-local-variable 'mail-send-actions) |
| 478 | (set-syntax-table mail-mode-syntax-table) | ||
| 479 | (use-local-map mail-mode-map) | ||
| 480 | (setq local-abbrev-table text-mode-abbrev-table) | ||
| 481 | (setq major-mode 'mail-mode) | ||
| 482 | (setq mode-name "Mail") | ||
| 483 | (setq buffer-offer-save t) | 475 | (setq buffer-offer-save t) |
| 484 | (make-local-variable 'font-lock-defaults) | 476 | (make-local-variable 'font-lock-defaults) |
| 485 | (setq font-lock-defaults '(mail-font-lock-keywords t t)) | 477 | (setq font-lock-defaults '(mail-font-lock-keywords t t)) |
| @@ -494,12 +486,12 @@ Turning on Mail mode runs the normal hooks `text-mode-hook' and | |||
| 494 | (set (make-local-variable 'comment-start) mail-yank-prefix) | 486 | (set (make-local-variable 'comment-start) mail-yank-prefix) |
| 495 | (make-local-variable 'adaptive-fill-regexp) | 487 | (make-local-variable 'adaptive-fill-regexp) |
| 496 | (setq adaptive-fill-regexp | 488 | (setq adaptive-fill-regexp |
| 497 | (concat adaptive-fill-regexp | 489 | (concat "[ \t]*[-[:alnum:]]*>+[ \t]*\\|" |
| 498 | "\\|[ \t]*[-[:alnum:]]*>+[ \t]*")) | 490 | adaptive-fill-regexp)) |
| 499 | (make-local-variable 'adaptive-fill-first-line-regexp) | 491 | (make-local-variable 'adaptive-fill-first-line-regexp) |
| 500 | (setq adaptive-fill-first-line-regexp | 492 | (setq adaptive-fill-first-line-regexp |
| 501 | (concat adaptive-fill-first-line-regexp | 493 | (concat "[ \t]*[-[:alnum:]]*>+[ \t]*\\|" |
| 502 | "\\|[ \t]*[-[:alnum:]]*>+[ \t]*")) | 494 | adaptive-fill-first-line-regexp)) |
| 503 | ;; `-- ' precedes the signature. `-----' appears at the start of the | 495 | ;; `-- ' precedes the signature. `-----' appears at the start of the |
| 504 | ;; lines that delimit forwarded messages. | 496 | ;; lines that delimit forwarded messages. |
| 505 | ;; Lines containing just >= 3 dashes, perhaps after whitespace, | 497 | ;; Lines containing just >= 3 dashes, perhaps after whitespace, |
| @@ -509,8 +501,7 @@ Turning on Mail mode runs the normal hooks `text-mode-hook' and | |||
| 509 | "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|" | 501 | "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|" |
| 510 | "-- $\\|---+$\\|" | 502 | "-- $\\|---+$\\|" |
| 511 | page-delimiter)) | 503 | page-delimiter)) |
| 512 | (setq paragraph-separate paragraph-start) | 504 | (setq paragraph-separate paragraph-start)) |
| 513 | (run-hooks 'text-mode-hook 'mail-mode-hook)) | ||
| 514 | 505 | ||
| 515 | 506 | ||
| 516 | (defun mail-header-end () | 507 | (defun mail-header-end () |
| @@ -597,7 +588,7 @@ If within the headers, this makes the new lines into continuation lines." | |||
| 597 | 588 | ||
| 598 | (if mail-mode-map | 589 | (if mail-mode-map |
| 599 | nil | 590 | nil |
| 600 | (setq mail-mode-map (nconc (make-sparse-keymap) text-mode-map)) | 591 | (setq mail-mode-map (make-sparse-keymap)) |
| 601 | (define-key mail-mode-map "\M-\t" 'mail-complete) | 592 | (define-key mail-mode-map "\M-\t" 'mail-complete) |
| 602 | (define-key mail-mode-map "\C-c?" 'describe-mode) | 593 | (define-key mail-mode-map "\C-c?" 'describe-mode) |
| 603 | (define-key mail-mode-map "\C-c\C-f\C-t" 'mail-to) | 594 | (define-key mail-mode-map "\C-c\C-f\C-t" 'mail-to) |