diff options
| author | Richard M. Stallman | 2008-12-22 21:16:43 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2008-12-22 21:16:43 +0000 |
| commit | 273f29683f524f08a2637e18ee03f217f1dc0c48 (patch) | |
| tree | 4bb5efdd9eb079a9b70c99a9696e3df257d3d830 | |
| parent | a9051c8850591efe9288c21025ba7a04f4f42aa2 (diff) | |
| download | emacs-273f29683f524f08a2637e18ee03f217f1dc0c48.tar.gz emacs-273f29683f524f08a2637e18ee03f217f1dc0c48.zip | |
(pmail-retried-attr-index, pmail-forwarded-attr-index):
Renamed from pmail-resent-attr-index and pmail-stored-attr-index.
(pmail-attr-array): Change names to `retried' and `forwarded'
(pmail-get-header): Don't unswap, just look at the data where it is.
(pmail-set-attribute): Don't unswap, just set the data where it is.
(pmail-reply): Use pmail-answered-attr-index.
(pmail-forward): Use pmail-forwarded-attr-index.
(pmail-retry-failure): Use pmail-retried-attr-index.
(pmail-show-message): Call pmail-swap-buffers-maybe before reswapping.
(pmail-get-attr-names): Doc fix.
(pmail-is-text-p): Doc fix.
| -rw-r--r-- | lisp/mail/pmail.el | 128 |
1 files changed, 65 insertions, 63 deletions
diff --git a/lisp/mail/pmail.el b/lisp/mail/pmail.el index c8ecb6d02f7..1b699a612bf 100644 --- a/lisp/mail/pmail.el +++ b/lisp/mail/pmail.el | |||
| @@ -61,10 +61,10 @@ | |||
| 61 | (defconst pmail-filed-attr-index 3 | 61 | (defconst pmail-filed-attr-index 3 |
| 62 | "The index for the `filed' attribute.") | 62 | "The index for the `filed' attribute.") |
| 63 | 63 | ||
| 64 | (defconst pmail-resent-attr-index 4 | 64 | (defconst pmail-retried-attr-index 4 |
| 65 | "The index for the `resent' attribute.") | 65 | "The index for the `retried' attribute.") |
| 66 | 66 | ||
| 67 | (defconst pmail-stored-attr-index 5 | 67 | (defconst pmail-forwarded-attr-index 5 |
| 68 | "The index for the `stored' attribute.") | 68 | "The index for the `stored' attribute.") |
| 69 | 69 | ||
| 70 | (defconst pmail-unseen-attr-index 6 | 70 | (defconst pmail-unseen-attr-index 6 |
| @@ -75,8 +75,8 @@ | |||
| 75 | (?D "deleted") | 75 | (?D "deleted") |
| 76 | (?E "edited") | 76 | (?E "edited") |
| 77 | (?F "filed") | 77 | (?F "filed") |
| 78 | (?R "replied") | 78 | (?R "retried") |
| 79 | (?S "stored") | 79 | (?S "forwarded") |
| 80 | (?U "unseen")] | 80 | (?U "unseen")] |
| 81 | "An array that provides a mapping between an attribute index, | 81 | "An array that provides a mapping between an attribute index, |
| 82 | its character representation and its display representation.") | 82 | its character representation and its display representation.") |
| @@ -2037,30 +2037,33 @@ otherwise, show it in full." | |||
| 2037 | 2037 | ||
| 2038 | ;;;; *** Pmail Attributes and Keywords *** | 2038 | ;;;; *** Pmail Attributes and Keywords *** |
| 2039 | 2039 | ||
| 2040 | (defun pmail-get-header (name &optional msg) | 2040 | (defun pmail-get-header (name &optional msgnum) |
| 2041 | "Return the value of message header NAME, nil if no such header | 2041 | "Return the value of message header NAME, nil if it has none. |
| 2042 | exists. MSG, if set identifies the message number to use. The | 2042 | MSGNUM specifies the message number to get it from. |
| 2043 | current mail message will be used otherwise." | 2043 | If MSGNUM is nil, use the current message." |
| 2044 | (pmail-swap-buffers-maybe) | 2044 | (with-current-buffer pmail-buffer |
| 2045 | (save-excursion | 2045 | (or msgnum (setq msgnum pmail-current-message)) |
| 2046 | (save-restriction | 2046 | (when (> msgnum 0) |
| 2047 | (with-current-buffer pmail-buffer | 2047 | (let (msgbeg end) |
| 2048 | (widen) | 2048 | (setq msgbeg (pmail-msgbeg msgnum)) |
| 2049 | (let* ((n (or msg pmail-current-message)) | 2049 | (save-excursion |
| 2050 | (beg (pmail-msgbeg n)) | 2050 | (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer)) |
| 2051 | end) | 2051 | (save-restriction |
| 2052 | (goto-char beg) | 2052 | (widen) |
| 2053 | (setq end (search-forward "\n\n" nil t)) | 2053 | (save-excursion |
| 2054 | (if end | 2054 | (goto-char msgbeg) |
| 2055 | (progn | 2055 | (setq end (search-forward "\n\n" nil t)) |
| 2056 | (narrow-to-region beg end) | 2056 | (if end |
| 2057 | (mail-fetch-field name)) | 2057 | (progn |
| 2058 | (pmail-error-bad-format msg))))))) | 2058 | (narrow-to-region msgbeg end) |
| 2059 | (mail-fetch-field name)) | ||
| 2060 | (pmail-error-bad-format msgnum))))))))) | ||
| 2061 | |||
| 2059 | 2062 | ||
| 2060 | (defun pmail-get-attr-names (&optional msg) | 2063 | (defun pmail-get-attr-names (&optional msg) |
| 2061 | "Return the message attributes in a comma separated string. | 2064 | "Return the message attributes in a comma separated string. |
| 2062 | MSG, if set identifies the message number to use. The current | 2065 | MSG specifies the message number to get it from. |
| 2063 | mail message will be used otherwise." | 2066 | If MSG is nil, use the current message." |
| 2064 | (let ((value (pmail-get-header pmail-attribute-header msg)) | 2067 | (let ((value (pmail-get-header pmail-attribute-header msg)) |
| 2065 | result temp) | 2068 | result temp) |
| 2066 | (dotimes (index (length value)) | 2069 | (dotimes (index (length value)) |
| @@ -2120,41 +2123,40 @@ STATE is either nil or the character (numeric) value associated | |||
| 2120 | with the state (nil represents off and non-nil represents on). | 2123 | with the state (nil represents off and non-nil represents on). |
| 2121 | ATTR is the index of the attribute. MSGNUM is message number to | 2124 | ATTR is the index of the attribute. MSGNUM is message number to |
| 2122 | change; nil means current message." | 2125 | change; nil means current message." |
| 2123 | (set-buffer pmail-buffer) | 2126 | (with-current-buffer pmail-buffer |
| 2124 | (pmail-swap-buffers-maybe) | 2127 | (let ((value (pmail-get-attr-value attr state)) |
| 2125 | (let ((value (pmail-get-attr-value attr state)) | 2128 | (omax (point-max-marker)) |
| 2126 | (omax (point-max-marker)) | 2129 | (omin (point-min-marker)) |
| 2127 | (omin (point-min-marker)) | 2130 | (buffer-read-only nil) |
| 2128 | (buffer-read-only nil) | 2131 | limit |
| 2129 | limit) | 2132 | msgbeg) |
| 2130 | (or msgnum (setq msgnum pmail-current-message)) | 2133 | (or msgnum (setq msgnum pmail-current-message)) |
| 2131 | (if (> msgnum 0) | 2134 | (when (> msgnum 0) |
| 2135 | (if (= attr pmail-deleted-attr-index) | ||
| 2136 | (pmail-set-message-deleted-p msgnum state)) | ||
| 2137 | (setq msgbeg (pmail-msgbeg msgnum)) | ||
| 2138 | |||
| 2132 | (unwind-protect | 2139 | (unwind-protect |
| 2133 | (save-excursion | 2140 | (save-excursion |
| 2134 | ;; Determine if the current state is the desired state. | 2141 | (if (pmail-buffers-swapped-p) (set-buffer pmail-view-buffer)) |
| 2135 | (widen) | 2142 | (save-restriction |
| 2136 | (goto-char (pmail-msgbeg msgnum)) | 2143 | (widen) |
| 2137 | (save-excursion | 2144 | (save-excursion |
| 2138 | (setq limit (search-forward "\n\n" nil t))) | 2145 | ;; Determine if the current state is the desired state. |
| 2139 | (if (search-forward (concat pmail-attribute-header ": ") limit t) | 2146 | (goto-char msgbeg) |
| 2140 | (progn (forward-char attr) | 2147 | (save-excursion |
| 2141 | (when (/= value (char-after)) | 2148 | (setq limit (search-forward "\n\n" nil t))) |
| 2142 | (delete-char 1) | 2149 | (if (search-forward (concat pmail-attribute-header ": ") limit t) |
| 2143 | (insert value))) | 2150 | (progn (forward-char attr) |
| 2144 | (let ((header-value "-------")) | 2151 | (when (/= value (char-after)) |
| 2145 | (aset header-value attr value) | 2152 | (delete-char 1) |
| 2146 | (goto-char (if limit (- limit 1) (point-max))) | 2153 | (insert value))) |
| 2147 | (insert pmail-attribute-header ": " header-value "\n"))) | 2154 | (let ((header-value "-------")) |
| 2148 | (if (= attr pmail-deleted-attr-index) | 2155 | (aset header-value attr value) |
| 2149 | (pmail-set-message-deleted-p msgnum state))) | 2156 | (goto-char (if limit (- limit 1) (point-max))) |
| 2150 | ;; Note: we don't use save-restriction because that does not work right | 2157 | (insert pmail-attribute-header ": " header-value "\n")))))) |
| 2151 | ;; if changes are made outside the saved restriction | ||
| 2152 | ;; before that restriction is restored. | ||
| 2153 | (narrow-to-region omin omax) | ||
| 2154 | (set-marker omin nil) | ||
| 2155 | (set-marker omax nil) | ||
| 2156 | (if (= msgnum pmail-current-message) | 2158 | (if (= msgnum pmail-current-message) |
| 2157 | (pmail-display-labels)))))) | 2159 | (pmail-display-labels))))))) |
| 2158 | 2160 | ||
| 2159 | (defun pmail-message-attr-p (msg attrs) | 2161 | (defun pmail-message-attr-p (msg attrs) |
| 2160 | "Return t if the attributes header for message MSG contains a | 2162 | "Return t if the attributes header for message MSG contains a |
| @@ -2472,8 +2474,7 @@ If summary buffer is currently displayed, update current message there also." | |||
| 2472 | (message blurb)))) | 2474 | (message blurb)))) |
| 2473 | 2475 | ||
| 2474 | (defun pmail-is-text-p () | 2476 | (defun pmail-is-text-p () |
| 2475 | "Return t if the region contains a text message, nil | 2477 | "Return t if the region contains a text message, nil otherwise." |
| 2476 | otherwise." | ||
| 2477 | (save-excursion | 2478 | (save-excursion |
| 2478 | (let ((text-regexp "\\(text\\|message\\)/") | 2479 | (let ((text-regexp "\\(text\\|message\\)/") |
| 2479 | (content-type-header (mail-fetch-field "content-type"))) | 2480 | (content-type-header (mail-fetch-field "content-type"))) |
| @@ -2506,6 +2507,7 @@ The current mail message becomes the message displayed." | |||
| 2506 | ;; Mark the message as seen, bracket the message in the mail | 2507 | ;; Mark the message as seen, bracket the message in the mail |
| 2507 | ;; buffer and determine the coding system the transfer encoding. | 2508 | ;; buffer and determine the coding system the transfer encoding. |
| 2508 | (pmail-set-attribute pmail-unseen-attr-index nil) | 2509 | (pmail-set-attribute pmail-unseen-attr-index nil) |
| 2510 | (pmail-swap-buffers-maybe) | ||
| 2509 | (setq beg (pmail-msgbeg msg) | 2511 | (setq beg (pmail-msgbeg msg) |
| 2510 | end (pmail-msgend msg)) | 2512 | end (pmail-msgend msg)) |
| 2511 | (widen) | 2513 | (widen) |
| @@ -3259,7 +3261,7 @@ use \\[mail-yank-original] to yank the original message into it." | |||
| 3259 | pmail-buffer | 3261 | pmail-buffer |
| 3260 | (with-current-buffer pmail-buffer | 3262 | (with-current-buffer pmail-buffer |
| 3261 | (aref pmail-msgref-vector msgnum)) | 3263 | (aref pmail-msgref-vector msgnum)) |
| 3262 | "answered")) | 3264 | pmail-answered-attr-index)) |
| 3263 | nil | 3265 | nil |
| 3264 | (list (cons "References" (concat (mapconcat 'identity references " ") | 3266 | (list (cons "References" (concat (mapconcat 'identity references " ") |
| 3265 | " " message-id)))))) | 3267 | " " message-id)))))) |
| @@ -3356,7 +3358,7 @@ see the documentation of `pmail-resend'." | |||
| 3356 | forward-buffer | 3358 | forward-buffer |
| 3357 | (with-current-buffer pmail-buffer | 3359 | (with-current-buffer pmail-buffer |
| 3358 | (aref pmail-msgref-vector msgnum)) | 3360 | (aref pmail-msgref-vector msgnum)) |
| 3359 | "forwarded")) | 3361 | pmail-forwarded-attr-index)) |
| 3360 | ;; If only one window, use it for the mail buffer. | 3362 | ;; If only one window, use it for the mail buffer. |
| 3361 | ;; Otherwise, use another window for the mail buffer | 3363 | ;; Otherwise, use another window for the mail buffer |
| 3362 | ;; so that the Pmail buffer remains visible | 3364 | ;; so that the Pmail buffer remains visible |
| @@ -3584,7 +3586,7 @@ specifying headers which should not be copied into the new message." | |||
| 3584 | (list (list 'pmail-mark-message | 3586 | (list (list 'pmail-mark-message |
| 3585 | pmail-this-buffer | 3587 | pmail-this-buffer |
| 3586 | (aref pmail-msgref-vector msgnum) | 3588 | (aref pmail-msgref-vector msgnum) |
| 3587 | "retried"))) | 3589 | pmail-retried-attr-index))) |
| 3588 | ;; Insert original text as initial text of new draft message. | 3590 | ;; Insert original text as initial text of new draft message. |
| 3589 | ;; Bind inhibit-read-only since the header delimiter | 3591 | ;; Bind inhibit-read-only since the header delimiter |
| 3590 | ;; of the previous message was probably read-only. | 3592 | ;; of the previous message was probably read-only. |