diff options
| author | Glenn Morris | 2009-01-28 02:49:40 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-01-28 02:49:40 +0000 |
| commit | 3ea5d765e79601c6fe4988ed7d11cd6d4117bd36 (patch) | |
| tree | 60f52c45111567d96dba47f05290eca866a73a70 | |
| parent | bdd9d085a5caf6c9a399b05cb05b253d9069b874 (diff) | |
| download | emacs-3ea5d765e79601c6fe4988ed7d11cd6d4117bd36.tar.gz emacs-3ea5d765e79601c6fe4988ed7d11cd6d4117bd36.zip | |
(rmail-message-recipients-p-1): Don't bother
starting from the beginning, since mail-fetch-field does not care.
(rmail-create-summary-line): Fix unseen handling. (Bug#2089)
(rmail-get-summary-status): New name for old rmail-get-summary-labels.
(rmail-get-summary-labels): New function. Returns labels rather than
status (edited, etc).
(rmail-create-summary): Insert an extra space after the status
flags, for consistency with old rmail, and with current
rmail-summary-font-lock-keywords.
| -rw-r--r-- | lisp/mail/rmailsum.el | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index a5c26ccc076..6a405dd1582 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el | |||
| @@ -111,7 +111,8 @@ RECIPIENTS is a string of regexps separated by commas." | |||
| 111 | recipients primary-only)) | 111 | recipients primary-only)) |
| 112 | 112 | ||
| 113 | (defun rmail-message-recipients-p-1 (recipients &optional primary-only) | 113 | (defun rmail-message-recipients-p-1 (recipients &optional primary-only) |
| 114 | (narrow-to-region (point) (save-excursion (search-forward "\n\n") (point))) | 114 | ;; mail-fetch-field does not care where it starts from. |
| 115 | (narrow-to-region (point) (progn (search-forward "\n\n") (point))) | ||
| 115 | (or (string-match recipients (or (mail-fetch-field "To") "")) | 116 | (or (string-match recipients (or (mail-fetch-field "To") "")) |
| 116 | (string-match recipients (or (mail-fetch-field "From") "")) | 117 | (string-match recipients (or (mail-fetch-field "From") "")) |
| 117 | (if (not primary-only) | 118 | (if (not primary-only) |
| @@ -138,6 +139,7 @@ Emacs will list the header line in the RMAIL-summary." | |||
| 138 | (rmail-apply-in-message msg 'rmail-message-regexp-p-1 msg regexp)) | 139 | (rmail-apply-in-message msg 'rmail-message-regexp-p-1 msg regexp)) |
| 139 | 140 | ||
| 140 | (defun rmail-message-regexp-p-1 (msg regexp) | 141 | (defun rmail-message-regexp-p-1 (msg regexp) |
| 142 | ;; Search functions can expect to start from the beginning. | ||
| 141 | (narrow-to-region (point) (save-excursion (search-forward "\n\n") (point))) | 143 | (narrow-to-region (point) (save-excursion (search-forward "\n\n") (point))) |
| 142 | (if rmail-enable-mime | 144 | (if rmail-enable-mime |
| 143 | (if rmail-search-mime-header-function | 145 | (if rmail-search-mime-header-function |
| @@ -361,8 +363,9 @@ even if its text is swapped." | |||
| 361 | (let ((beg (rmail-msgbeg msgnum)) | 363 | (let ((beg (rmail-msgbeg msgnum)) |
| 362 | (end (rmail-msgend msgnum)) | 364 | (end (rmail-msgend msgnum)) |
| 363 | (deleted (rmail-message-deleted-p msgnum)) | 365 | (deleted (rmail-message-deleted-p msgnum)) |
| 364 | (unseen (rmail-message-unseen-p msgnum)) | 366 | ;; Does not work (swapped?) |
| 365 | lines) | 367 | ;;; (unseen (rmail-message-unseen-p msgnum)) |
| 368 | unseen lines) | ||
| 366 | (save-excursion | 369 | (save-excursion |
| 367 | ;; Switch to the buffer that has the whole mbox text. | 370 | ;; Switch to the buffer that has the whole mbox text. |
| 368 | (if (rmail-buffers-swapped-p) | 371 | (if (rmail-buffers-swapped-p) |
| @@ -377,12 +380,24 @@ even if its text is swapped." | |||
| 377 | (if (search-forward "\n\n" end t) | 380 | (if (search-forward "\n\n" end t) |
| 378 | (save-restriction | 381 | (save-restriction |
| 379 | (narrow-to-region beg (point)) | 382 | (narrow-to-region beg (point)) |
| 383 | ;; Replace rmail-message-unseen-p from above. | ||
| 384 | (goto-char beg) | ||
| 385 | (setq unseen (and (search-forward | ||
| 386 | (concat rmail-attribute-header ": ") nil t) | ||
| 387 | (looking-at "......U"))) | ||
| 380 | ;; Generate a status line from the message. | 388 | ;; Generate a status line from the message. |
| 381 | (rmail-create-summary msgnum deleted unseen lines)) | 389 | (rmail-create-summary msgnum deleted unseen lines)) |
| 382 | (rmail-error-bad-format msgnum)))))) | 390 | (rmail-error-bad-format msgnum)))))) |
| 383 | 391 | ||
| 384 | (defun rmail-get-summary-labels () | 392 | ;; FIXME this is now unused. |
| 385 | "Return a coded string wrapped in curly braces denoting the status labels. | 393 | ;; The intention was to display in the summary something like {E} |
| 394 | ;; for an edited messaged, similarly for answered, etc. | ||
| 395 | ;; But that conflicts with the previous rmail usage, where | ||
| 396 | ;; any user-defined { labels } occupied this space. | ||
| 397 | ;; So whilst it would be nice to have this information in the summary, | ||
| 398 | ;; it would need to go somewhere else. | ||
| 399 | (defun rmail-get-summary-status () | ||
| 400 | "Return a coded string wrapped in curly braces denoting the status. | ||
| 386 | 401 | ||
| 387 | The current buffer must already be narrowed to the message headers for | 402 | The current buffer must already be narrowed to the message headers for |
| 388 | the message being processed." | 403 | the message being processed." |
| @@ -404,6 +419,14 @@ the message being processed." | |||
| 404 | (setq result (concat "{" result "}"))) | 419 | (setq result (concat "{" result "}"))) |
| 405 | result)) | 420 | result)) |
| 406 | 421 | ||
| 422 | (defun rmail-get-summary-labels () | ||
| 423 | "Return a string wrapped in curly braces with the current message labels. | ||
| 424 | Returns nil if there are no labels. The current buffer must | ||
| 425 | already be narrowed to the message headers for the message being | ||
| 426 | processed." | ||
| 427 | (let ((labels (mail-fetch-field rmail-keyword-header))) | ||
| 428 | (if labels (format "{ %s } " labels)))) | ||
| 429 | |||
| 407 | (defun rmail-create-summary (msgnum deleted unseen lines) | 430 | (defun rmail-create-summary (msgnum deleted unseen lines) |
| 408 | "Return the summary line for message MSGNUM. | 431 | "Return the summary line for message MSGNUM. |
| 409 | The current buffer should already be narrowed to the header for that message. | 432 | The current buffer should already be narrowed to the header for that message. |
| @@ -431,7 +454,7 @@ LINES is the number of lines in the message (if we should display that) | |||
| 431 | (deleted ?D) | 454 | (deleted ?D) |
| 432 | (unseen ?-) | 455 | (unseen ?-) |
| 433 | (t ? )) | 456 | (t ? )) |
| 434 | prefix (format "%5d%c" msgnum status) | 457 | prefix (format "%5d%c " msgnum status) |
| 435 | basic-start (car line) | 458 | basic-start (car line) |
| 436 | basic-end (cadr line)) | 459 | basic-end (cadr line)) |
| 437 | (funcall rmail-summary-line-decoder | 460 | (funcall rmail-summary-line-decoder |