Mercurial > emacs
comparison lisp/mail/rmailsum.el @ 88234:76be5e1eba7d
(rmail-summary-get-summary): Fix display of
keywords.
(rmail-summary-rmail-update): Minor changes: If to when, comments,
doc string.
author | Alex Schroeder <alex@gnu.org> |
---|---|
date | Fri, 20 Jan 2006 16:23:51 +0000 |
parents | 2406115dbe50 |
children | e59b585c0d13 |
comparison
equal
deleted
inserted
replaced
88233:7ce784b88079 | 88234:76be5e1eba7d |
---|---|
581 If it moves to a message within an Incremental Search, and removes | 581 If it moves to a message within an Incremental Search, and removes |
582 the `unseen' attribute from that message, it sets this flag | 582 the `unseen' attribute from that message, it sets this flag |
583 so that if the next motion between messages is in the same Incremental | 583 so that if the next motion between messages is in the same Incremental |
584 Search, the `unseen' attribute is restored.") | 584 Search, the `unseen' attribute is restored.") |
585 | 585 |
586 ;; Show in Rmail the message described by the summary line that point is on, | |
587 ;; but only if the Rmail buffer is already visible. | |
588 ;; This is a post-command-hook in summary buffers. | |
589 (defun rmail-summary-rmail-update () | 586 (defun rmail-summary-rmail-update () |
590 "Update the Rmail summary buffer. | 587 "Update the Rmail summary buffer. |
591 Put the cursor on the beginning of the line containing the current | 588 Put the cursor on the beginning of the line containing the |
592 message and highlight the buffer." | 589 current message and highlight the buffer. Show in Rmail the |
590 message described by the summary line that point is on, but only | |
591 if the Rmail buffer is already visible. This is on | |
592 `post-command-hook' in summary buffers." | |
593 (let (buffer-read-only) | 593 (let (buffer-read-only) |
594 (save-excursion | 594 (save-excursion |
595 ;; If at end of buffer, pretend we are on the last text line. | 595 ;; If at end of buffer, pretend we are on the last text line. |
596 (if (eobp) | 596 (when (eobp) |
597 (forward-line -1)) | 597 (forward-line -1)) |
598 ;; Determine the message number correpsonding to line point is on. | 598 ;; Determine the message number corresponding to line point is on. |
599 (beginning-of-line) | 599 (beginning-of-line) |
600 (skip-chars-forward " ") | 600 (skip-chars-forward " ") |
601 (let ((msg-num (string-to-number (buffer-substring | 601 (let ((msg-num (string-to-number (buffer-substring |
602 (point) | 602 (point) |
603 (progn (skip-chars-forward "0-9") | 603 (progn (skip-chars-forward "0-9") |
604 (point)))))) | 604 (point)))))) |
605 | |
606 ;; Always leave `unseen' removed if we get out of isearch mode. | 605 ;; Always leave `unseen' removed if we get out of isearch mode. |
607 ;; Don't let a subsequent isearch restore `unseen'. | 606 ;; Don't let a subsequent isearch restore `unseen'. |
608 (if (not isearch-mode) | 607 (when (not isearch-mode) |
609 (setq rmail-summary-put-back-unseen nil)) | 608 (setq rmail-summary-put-back-unseen nil)) |
610 (or (eq rmail-current-message msg-num) | 609 (or (eq rmail-current-message msg-num) |
611 (let ((window (get-buffer-window rmail-view-buffer t)) | 610 (let ((window (get-buffer-window rmail-view-buffer t)) |
612 (owin (selected-window))) | 611 (owin (selected-window))) |
613 (if isearch-mode | 612 (if isearch-mode |
614 (save-excursion | 613 (save-excursion |
623 ;; Arrange to do that later, for the new current message, | 622 ;; Arrange to do that later, for the new current message, |
624 ;; if it still has `unseen'. | 623 ;; if it still has `unseen'. |
625 (setq rmail-summary-put-back-unseen | 624 (setq rmail-summary-put-back-unseen |
626 (member "unseen" (rmail-desc-get-keywords msg-num)))) | 625 (member "unseen" (rmail-desc-get-keywords msg-num)))) |
627 (setq rmail-summary-put-back-unseen nil)) | 626 (setq rmail-summary-put-back-unseen nil)) |
628 | |
629 ;; Go to the desired message. | 627 ;; Go to the desired message. |
630 (setq rmail-current-message msg-num) | 628 (setq rmail-current-message msg-num) |
631 | |
632 ;; Update the summary to show the message has been seen. | 629 ;; Update the summary to show the message has been seen. |
633 (if (= (following-char) ?-) | 630 (when (= (following-char) ?-) |
634 (progn | 631 (delete-char 1) |
635 (delete-char 1) | 632 (insert " ")) |
636 (insert " "))) | |
637 | |
638 (if window | 633 (if window |
639 ;; Using save-window-excursion would cause the new value | 634 ;; Using save-window-excursion would cause the new value |
640 ;; of point to get lost. | 635 ;; of point to get lost. |
641 (unwind-protect | 636 (unwind-protect |
642 (progn | 637 (progn |
643 (select-window window) | 638 (select-window window) |
644 (rmail-show-message msg-num t)) | 639 (rmail-show-message msg-num t)) |
645 (select-window owin)) | 640 (select-window owin)) |
646 (if (buffer-name rmail-buffer) | 641 (when (buffer-name rmail-buffer) |
647 (save-excursion | 642 (save-excursion |
648 (set-buffer rmail-buffer) | 643 (set-buffer rmail-buffer) |
649 (rmail-show-message msg-num t)))))) | 644 (rmail-show-message msg-num t)))))) |
650 (rmail-summary-update-highlight nil))))) | 645 (rmail-summary-update-highlight nil))))) |
651 | 646 |
652 (if rmail-summary-mode-map | 647 (if rmail-summary-mode-map |
1505 (or (rmail-desc-get-attr-code rmail-desc-edited-index n) " ") | 1500 (or (rmail-desc-get-attr-code rmail-desc-edited-index n) " ") |
1506 (or (rmail-desc-get-attr-code rmail-desc-stored-index n) " "))) | 1501 (or (rmail-desc-get-attr-code rmail-desc-stored-index n) " "))) |
1507 | 1502 |
1508 (defun rmail-summary-get-summary (n) | 1503 (defun rmail-summary-get-summary (n) |
1509 "Return a summary line for message N." | 1504 "Return a summary line for message N." |
1510 (let (keywords str) | 1505 (let (keywords str subj) |
1511 (dolist (keyword (rmail-desc-get-keywords n)) | 1506 (dolist (keyword (rmail-desc-get-keywords n)) |
1512 (when (and (rmail-keyword-p keyword) | 1507 (when (and (rmail-keyword-p keyword) |
1513 (not (rmail-attribute-p keyword))) | 1508 (not (rmail-attribute-p keyword))) |
1514 (setq keywords (cons keyword keywords)))) | 1509 (setq keywords (cons keyword keywords)))) |
1515 (setq keywords (nreverse keywords)) | 1510 (setq keywords (nreverse keywords) |
1516 (setq str (if keywords | 1511 str (if keywords |
1517 (concat "{ " (mapconcat 'identity keywords " ") " } ") | 1512 (concat "{ " (mapconcat 'identity keywords " ") " } ") |
1518 "")) | 1513 "") |
1514 subj (replace-regexp-in-string "\\s-+" " " | |
1515 (rmail-desc-get-subject n))) | |
1519 (funcall rmail-summary-line-decoder | 1516 (funcall rmail-summary-line-decoder |
1520 (format "%5s%s%6s %25s%s %s\n" | 1517 (format "%5s%s%6s %25s%s %s\n" |
1521 n | 1518 n |
1522 (rmail-summary-get-summary-attributes n) | 1519 (rmail-summary-get-summary-attributes n) |
1523 (concat (rmail-desc-get-day-number n) "-" | 1520 (concat (rmail-desc-get-day-number n) "-" |
1524 (rmail-desc-get-month n)) | 1521 (rmail-desc-get-month n)) |
1525 (rmail-desc-get-sender n) | 1522 (rmail-desc-get-sender n) |
1526 (rmail-summary-get-line-count n) | 1523 (rmail-summary-get-line-count n) |
1527 (concat str (rmail-desc-get-subject n)))))) | 1524 (concat str subj))))) |
1528 | 1525 |
1529 (defun rmail-summary-update (n) | 1526 (defun rmail-summary-update (n) |
1530 "Rewrite the summary line for message N." | 1527 "Rewrite the summary line for message N." |
1531 (with-current-buffer rmail-buffer | 1528 (with-current-buffer rmail-buffer |
1532 ;; we need to do this in the rmail-buffer lest the keywords are | 1529 ;; we need to do this in the rmail-buffer lest the keywords are |