comparison lisp/mail/rmailsum.el @ 16242:fa3885bdc49c

(rmail-summary-next-same-subject): Don't set search-regexp until after adjusting subject string. (rmail-summary-rmail-update): Bind rmail-not-really-seen non-nil if in isearch mode.
author Richard M. Stallman <rms@gnu.org>
date Thu, 19 Sep 1996 03:22:51 +0000
parents 996e272e9192
children ec0f59ba6768
comparison
equal deleted inserted replaced
16241:3c84b8d28902 16242:fa3885bdc49c
495 (let (subject search-regexp i found 495 (let (subject search-regexp i found
496 (forward (> n 0))) 496 (forward (> n 0)))
497 (save-excursion 497 (save-excursion
498 (set-buffer rmail-buffer) 498 (set-buffer rmail-buffer)
499 (setq subject (mail-fetch-field "Subject")) 499 (setq subject (mail-fetch-field "Subject"))
500 (setq search-regexp (concat "^Subject: *\\(Re: *\\)?"
501 (regexp-quote subject)
502 "\n"))
503 (setq i rmail-current-message)) 500 (setq i rmail-current-message))
504 (if (string-match "Re:[ \t]*" subject) 501 (if (string-match "Re:[ \t]*" subject)
505 (setq subject (substring subject (match-end 0)))) 502 (setq subject (substring subject (match-end 0))))
503 (setq search-regexp (concat "^Subject: *\\(Re: *\\)?"
504 (regexp-quote subject)
505 "\n"))
506 (save-excursion 506 (save-excursion
507 (while (and (/= n 0) 507 (while (and (/= n 0)
508 (if forward 508 (if forward
509 (not (eobp)) 509 (not (eobp))
510 (not (bobp)))) 510 (not (bobp))))
696 (defun rmail-summary-enable () 696 (defun rmail-summary-enable ()
697 (use-local-map rmail-summary-mode-map) 697 (use-local-map rmail-summary-mode-map)
698 (add-hook 'post-command-hook 'rmail-summary-rmail-update nil t) 698 (add-hook 'post-command-hook 'rmail-summary-rmail-update nil t)
699 (setq revert-buffer-function 'rmail-update-summary)) 699 (setq revert-buffer-function 'rmail-update-summary))
700 700
701 (defvar rmail-summary-put-back-unseen nil
702 "Used for communicating between calls to `rmail-summary-rmail-update'.
703 If it moves to a message within an Incremental Search, and removes
704 the `unseen' attribute from that message, it sets this flag
705 so that if the next motion between messages is in the same Incremental
706 Search, the `unseen' attribute is restored.")
707
701 ;; Show in Rmail the message described by the summary line that point is on, 708 ;; Show in Rmail the message described by the summary line that point is on,
702 ;; but only if the Rmail buffer is already visible. 709 ;; but only if the Rmail buffer is already visible.
703 ;; This is a post-command-hook in summary buffers. 710 ;; This is a post-command-hook in summary buffers.
704 (defun rmail-summary-rmail-update () 711 (defun rmail-summary-rmail-update ()
705 (let (buffer-read-only) 712 (let (buffer-read-only)
711 (skip-chars-forward " ") 718 (skip-chars-forward " ")
712 (let ((msg-num (string-to-int (buffer-substring 719 (let ((msg-num (string-to-int (buffer-substring
713 (point) 720 (point)
714 (progn (skip-chars-forward "0-9") 721 (progn (skip-chars-forward "0-9")
715 (point)))))) 722 (point))))))
723 ;; Always leave `unseen' removed
724 ;; if we get out of isearch mode.
725 ;; Don't let a subsequent isearch restore that `unseen'.
726 (if (not isearch-mode)
727 (setq rmail-summary-put-back-unseen nil))
728
716 (or (eq rmail-current-message msg-num) 729 (or (eq rmail-current-message msg-num)
717 (let ((window (get-buffer-window rmail-buffer)) 730 (let ((window (get-buffer-window rmail-buffer))
718 (owin (selected-window))) 731 (owin (selected-window)))
732 (if isearch-mode
733 (save-excursion
734 (set-buffer rmail-buffer)
735 ;; If we first saw the previous message in this search,
736 ;; and we have gone to a different message while searching,
737 ;; put back `unseen' on the former one.
738 (rmail-set-attribute "unseen" t
739 rmail-current-message)
740 ;; Arrange to do that later, for the new current message,
741 ;; if it still has `unseen'.
742 (setq rmail-summary-put-back-unseen
743 (rmail-message-labels-p msg-num ", ?\\(unseen\\),")))
744 (setq rmail-summary-put-back-unseen nil))
745
746 ;; Go to the desired message.
719 (setq rmail-current-message msg-num) 747 (setq rmail-current-message msg-num)
748
749 ;; Update the summary to show the message has been seen.
720 (if (= (following-char) ?-) 750 (if (= (following-char) ?-)
721 (progn 751 (progn
722 (delete-char 1) 752 (delete-char 1)
723 (insert " "))) 753 (insert " ")))
754
724 (if window 755 (if window
725 ;; Using save-window-excursion would cause the new value 756 ;; Using save-window-excursion would cause the new value
726 ;; of point to get lost. 757 ;; of point to get lost.
727 (unwind-protect 758 (unwind-protect
728 (progn 759 (progn