Mercurial > emacs
comparison lisp/mail/pmail.el @ 100756:d9d23e4f6b00
(pmail-forwarded-attr-index): Doc fix.
(pmail-resent-attr-index): New variable.
(pmail-attr-array): Add r for resent.
(pmail-add-mbox-headers): Make 8 attributes.
(pmail-set-attribute): Extend attribute line if necessary.
(pmail-widen): New command.
(pmail-mode-map): o is pmail-output, C-o is pmail-output-as-seen,
(pmail-mode-map): c-w is pmail-widen.
(pmail-change-major-mode-hook): Do nothing unless buffer-swapped-with.
(pmail-show-message): Downcase character-coding.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 29 Dec 2008 19:16:37 +0000 |
parents | 3bc2687bdff2 |
children | e680c5af27d3 |
comparison
equal
deleted
inserted
replaced
100755:818664433c32 | 100756:d9d23e4f6b00 |
---|---|
63 | 63 |
64 (defconst pmail-retried-attr-index 4 | 64 (defconst pmail-retried-attr-index 4 |
65 "The index for the `retried' attribute.") | 65 "The index for the `retried' attribute.") |
66 | 66 |
67 (defconst pmail-forwarded-attr-index 5 | 67 (defconst pmail-forwarded-attr-index 5 |
68 "The index for the `stored' attribute.") | 68 "The index for the `forwarded' attribute.") |
69 | 69 |
70 (defconst pmail-unseen-attr-index 6 | 70 (defconst pmail-unseen-attr-index 6 |
71 "The index for the `unseen' attribute.") | 71 "The index for the `unseen' attribute.") |
72 | |
73 (defconst pmail-resent-attr-index 6 | |
74 "The index for the `resent' attribute.") | |
72 | 75 |
73 (defconst pmail-attr-array | 76 (defconst pmail-attr-array |
74 '[(?A "answered") | 77 '[(?A "answered") |
75 (?D "deleted") | 78 (?D "deleted") |
76 (?E "edited") | 79 (?E "edited") |
77 (?F "filed") | 80 (?F "filed") |
78 (?R "retried") | 81 (?R "retried") |
79 (?S "forwarded") | 82 (?S "forwarded") |
80 (?U "unseen")] | 83 (?U "unseen") |
84 (?r "resent")] | |
81 "An array that provides a mapping between an attribute index, | 85 "An array that provides a mapping between an attribute index, |
82 its character representation and its display representation.") | 86 its character representation and its display representation.") |
83 | 87 |
84 (defvar deleted-head) | 88 (defvar deleted-head) |
85 (defvar font-lock-fontified) | 89 (defvar font-lock-fontified) |
984 (define-key pmail-mode-map "m" 'pmail-mail) | 988 (define-key pmail-mode-map "m" 'pmail-mail) |
985 (define-key pmail-mode-map "\em" 'pmail-retry-failure) | 989 (define-key pmail-mode-map "\em" 'pmail-retry-failure) |
986 (define-key pmail-mode-map "n" 'pmail-next-undeleted-message) | 990 (define-key pmail-mode-map "n" 'pmail-next-undeleted-message) |
987 (define-key pmail-mode-map "\en" 'pmail-next-message) | 991 (define-key pmail-mode-map "\en" 'pmail-next-message) |
988 (define-key pmail-mode-map "\e\C-n" 'pmail-next-labeled-message) | 992 (define-key pmail-mode-map "\e\C-n" 'pmail-next-labeled-message) |
989 (define-key pmail-mode-map "o" 'pmail-output-to-babyl-file) | 993 (define-key pmail-mode-map "o" 'pmail-output) |
990 (define-key pmail-mode-map "\C-o" 'pmail-output) | 994 (define-key pmail-mode-map "\C-o" 'pmail-output-as-seen) |
991 (define-key pmail-mode-map "p" 'pmail-previous-undeleted-message) | 995 (define-key pmail-mode-map "p" 'pmail-previous-undeleted-message) |
992 (define-key pmail-mode-map "\ep" 'pmail-previous-message) | 996 (define-key pmail-mode-map "\ep" 'pmail-previous-message) |
993 (define-key pmail-mode-map "\e\C-p" 'pmail-previous-labeled-message) | 997 (define-key pmail-mode-map "\e\C-p" 'pmail-previous-labeled-message) |
994 (define-key pmail-mode-map "q" 'pmail-quit) | 998 (define-key pmail-mode-map "q" 'pmail-quit) |
995 (define-key pmail-mode-map "r" 'pmail-reply) | 999 (define-key pmail-mode-map "r" 'pmail-reply) |
998 (define-key pmail-mode-map "s" 'pmail-expunge-and-save) | 1002 (define-key pmail-mode-map "s" 'pmail-expunge-and-save) |
999 (define-key pmail-mode-map "\es" 'pmail-search) | 1003 (define-key pmail-mode-map "\es" 'pmail-search) |
1000 (define-key pmail-mode-map "t" 'pmail-toggle-header) | 1004 (define-key pmail-mode-map "t" 'pmail-toggle-header) |
1001 (define-key pmail-mode-map "u" 'pmail-undelete-previous-message) | 1005 (define-key pmail-mode-map "u" 'pmail-undelete-previous-message) |
1002 (define-key pmail-mode-map "w" 'pmail-output-body-to-file) | 1006 (define-key pmail-mode-map "w" 'pmail-output-body-to-file) |
1007 (define-key pmail-mode-map "C-w" 'pmail-widen) | |
1003 (define-key pmail-mode-map "x" 'pmail-expunge) | 1008 (define-key pmail-mode-map "x" 'pmail-expunge) |
1004 (define-key pmail-mode-map "." 'pmail-beginning-of-message) | 1009 (define-key pmail-mode-map "." 'pmail-beginning-of-message) |
1005 (define-key pmail-mode-map "/" 'pmail-end-of-message) | 1010 (define-key pmail-mode-map "/" 'pmail-end-of-message) |
1006 (define-key pmail-mode-map "<" 'pmail-first-message) | 1011 (define-key pmail-mode-map "<" 'pmail-first-message) |
1007 (define-key pmail-mode-map ">" 'pmail-last-message) | 1012 (define-key pmail-mode-map ">" 'pmail-last-message) |
1274 (unless buf | 1279 (unless buf |
1275 (generate-new-buffer name)))) | 1280 (generate-new-buffer name)))) |
1276 | 1281 |
1277 (defun pmail-change-major-mode-hook () | 1282 (defun pmail-change-major-mode-hook () |
1278 ;; Bring the actual Pmail messages back into the main buffer. | 1283 ;; Bring the actual Pmail messages back into the main buffer. |
1279 (when (pmail-buffers-swapped-p) | 1284 (if buffer-swapped-with |
1280 (setq buffer-swapped-with nil) | 1285 (when (pmail-buffers-swapped-p) |
1281 (buffer-swap-text pmail-view-buffer))) | 1286 (setq buffer-swapped-with nil) |
1287 (buffer-swap-text pmail-view-buffer)))) | |
1282 ;; Throw away the summary. | 1288 ;; Throw away the summary. |
1283 ;;(when (buffer-live-p pmail-view-buffer) (kill-buffer pmail-view-buffer))) | 1289 ;;(when (buffer-live-p pmail-view-buffer) (kill-buffer pmail-view-buffer))) |
1284 | 1290 |
1285 (defun pmail-buffers-swapped-p () | 1291 (defun pmail-buffers-swapped-p () |
1286 "Return non-nil if the message collection is in `pmail-view-buffer'." | 1292 "Return non-nil if the message collection is in `pmail-view-buffer'." |
1928 new messages. Return the number of new messages." | 1934 new messages. Return the number of new messages." |
1929 (save-excursion | 1935 (save-excursion |
1930 (save-restriction | 1936 (save-restriction |
1931 (let ((count 0) | 1937 (let ((count 0) |
1932 (start (point)) | 1938 (start (point)) |
1933 (value "------U") | 1939 (value "------U-") |
1934 limit) | 1940 limit) |
1935 ;; Detect an empty inbox file. | 1941 ;; Detect an empty inbox file. |
1936 (unless (= start (point-max)) | 1942 (unless (= start (point-max)) |
1937 ;; Scan the new messages to establish a count and to insure that | 1943 ;; Scan the new messages to establish a count and to insure that |
1938 ;; an attribute header is present. | 1944 ;; an attribute header is present. |
2143 (save-excursion | 2149 (save-excursion |
2144 (setq limit (search-forward "\n\n" nil t))) | 2150 (setq limit (search-forward "\n\n" nil t))) |
2145 (if (search-forward (concat pmail-attribute-header ": ") limit t) | 2151 (if (search-forward (concat pmail-attribute-header ": ") limit t) |
2146 ;; If this message already records attributes, | 2152 ;; If this message already records attributes, |
2147 ;; just change the value for this one. | 2153 ;; just change the value for this one. |
2148 (progn (forward-char attr) | 2154 (let ((missing (- (+ (point) attr) (line-end-position)))) |
2149 (when (/= value (char-after)) | 2155 ;; Position point at this attribute, |
2150 (delete-char 1) | 2156 ;; adding attributes if necessary. |
2151 (insert value))) | 2157 (if (> missing 0) |
2158 (progn | |
2159 (end-of-line) | |
2160 (insert-char ?- missing) | |
2161 (backward-char 1)) | |
2162 (forward-char attr)) | |
2163 ;; Change this attribute. | |
2164 (when (/= value (char-after)) | |
2165 (delete-char 1) | |
2166 (insert value))) | |
2152 ;; Otherwise add a header line to record the attributes | 2167 ;; Otherwise add a header line to record the attributes |
2153 ;; and set all but this one to nil. | 2168 ;; and set all but this one to no. |
2154 (let ((header-value "-------")) | 2169 (let ((header-value "--------")) |
2155 (aset header-value attr value) | 2170 (aset header-value attr value) |
2156 (goto-char (if limit (- limit 1) (point-max))) | 2171 (goto-char (if limit (- limit 1) (point-max))) |
2157 (insert pmail-attribute-header ": " header-value "\n")))))) | 2172 (insert pmail-attribute-header ": " header-value "\n")))))) |
2158 (if (= msgnum pmail-current-message) | 2173 (if (= msgnum pmail-current-message) |
2159 (pmail-display-labels))))))) | 2174 (pmail-display-labels))))))) |
2439 (with-current-buffer pmail-buffer | 2454 (with-current-buffer pmail-buffer |
2440 (when (pmail-buffers-swapped-p) | 2455 (when (pmail-buffers-swapped-p) |
2441 (buffer-swap-text pmail-view-buffer) | 2456 (buffer-swap-text pmail-view-buffer) |
2442 (setq buffer-swapped-with nil)))) | 2457 (setq buffer-swapped-with nil)))) |
2443 | 2458 |
2459 (defun pmail-widen () | |
2460 "Display the entire mailbox file." | |
2461 (interactive) | |
2462 (pmail-swap-buffers-maybe) | |
2463 (widen)) | |
2464 | |
2444 (defun pmail-show-message-maybe (&optional n no-summary) | 2465 (defun pmail-show-message-maybe (&optional n no-summary) |
2445 "Show message number N (prefix argument), counting from start of file. | 2466 "Show message number N (prefix argument), counting from start of file. |
2446 If summary buffer is currently displayed, update current message there also." | 2467 If summary buffer is currently displayed, update current message there also." |
2447 (interactive "p") | 2468 (interactive "p") |
2448 (or (eq major-mode 'pmail-mode) | 2469 (or (eq major-mode 'pmail-mode) |
2519 (narrow-to-region beg (point)) | 2540 (narrow-to-region beg (point)) |
2520 (goto-char beg) | 2541 (goto-char beg) |
2521 (setq character-coding (mail-fetch-field "content-transfer-encoding") | 2542 (setq character-coding (mail-fetch-field "content-transfer-encoding") |
2522 is-text-message (pmail-is-text-p) | 2543 is-text-message (pmail-is-text-p) |
2523 coding-system (pmail-get-coding-system)) | 2544 coding-system (pmail-get-coding-system)) |
2545 (if character-coding | |
2546 (setq character-coding (downcase character-coding))) | |
2524 (widen) | 2547 (widen) |
2525 (narrow-to-region beg end) | 2548 (narrow-to-region beg end) |
2526 ;; Decode the message body into an empty view buffer using a | 2549 ;; Decode the message body into an empty view buffer using a |
2527 ;; unibyte temporary buffer where the character decoding takes | 2550 ;; unibyte temporary buffer where the character decoding takes |
2528 ;; place. | 2551 ;; place. |