aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-05 02:46:34 +0000
committerRichard M. Stallman1995-02-05 02:46:34 +0000
commit71d97b562a533b7b3c6e0d188010bb6506c5338f (patch)
tree6dce063938ad4b5bef312d8d075d0c612f0683dd
parent60fb2b34a378097012f46db3ac9968ac7f60692e (diff)
downloademacs-71d97b562a533b7b3c6e0d188010bb6506c5338f.tar.gz
emacs-71d97b562a533b7b3c6e0d188010bb6506c5338f.zip
(rmail-summary-next-same-subject): New command.
(rmail-summary-previous-same-subject): Likewise. (rmail-summary-mode-map): Add bindings for C-c C-n and C-c C-p.
-rw-r--r--lisp/mail/rmailsum.el62
1 files changed, 61 insertions, 1 deletions
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 70ab33e7216..bb8060c5442 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -1,6 +1,6 @@
1;;; rmailsum.el --- make summary buffers for the mail reader 1;;; rmailsum.el --- make summary buffers for the mail reader
2 2
3;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5;; Maintainer: FSF 5;; Maintainer: FSF
6;; Keywords: mail 6;; Keywords: mail
@@ -429,6 +429,64 @@ With prefix argument N moves backward N messages with these labels."
429 (save-excursion 429 (save-excursion
430 (set-buffer rmail-buffer) 430 (set-buffer rmail-buffer)
431 (rmail-previous-labeled-message n labels))) 431 (rmail-previous-labeled-message n labels)))
432
433(defun rmail-summary-next-same-subject (n)
434 "Go to the next message in the summary having the same subject.
435With prefix argument N, do this N times.
436If N is negative, go backwards."
437 (interactive "p")
438 (let (subject search-regexp i found
439 (forward (> n 0)))
440 (save-excursion
441 (set-buffer rmail-buffer)
442 (setq subject (mail-fetch-field "Subject"))
443 (setq search-regexp (concat "^Subject: *\\(Re: *\\)?"
444 (regexp-quote subject)
445 "\n"))
446 (setq i rmail-current-message))
447 (if (string-match "Re:[ \t]*" subject)
448 (setq subject (substring subject (match-end 0))))
449 (save-excursion
450 (while (and (/= n 0)
451 (if forward
452 (not (eobp))
453 (not (bobp))))
454 (let (done)
455 (while (and (not done)
456 (if forward
457 (not (eobp))
458 (not (bobp))))
459 ;; Advance thru summary.
460 (forward-line (if forward 1 -1))
461 ;; Get msg number of this line.
462 (setq i (string-to-int
463 (buffer-substring (point)
464 (min (point-max) (+ 5 (point))))))
465 ;; See if that msg has desired subject.
466 (save-excursion
467 (set-buffer rmail-buffer)
468 (save-restriction
469 (widen)
470 (goto-char (rmail-msgbeg i))
471 (search-forward "\n*** EOOH ***\n")
472 (let ((beg (point)) end)
473 (search-forward "\n\n")
474 (setq end (point))
475 (goto-char beg)
476 (setq done (re-search-forward search-regexp end t))))))
477 (if done (setq found i)))
478 (setq n (if forward (1- n) (1+ n)))))
479 (if found
480 (rmail-summary-goto-msg found)
481 (error "No %s message with same subject"
482 (if forward "following" "previous")))))
483
484(defun rmail-summary-previous-same-subject (n)
485 "Go to the previous message in the summary having the same subject.
486With prefix argument N, do this N times.
487If N is negative, go forwards instead."
488 (interactive "p")
489 (rmail-summary-next-same-subject (- n)))
432 490
433;; Delete and undelete summary commands. 491;; Delete and undelete summary commands.
434 492
@@ -667,6 +725,8 @@ Commands for sorting the summary:
667 (define-key rmail-summary-mode-map " " 'rmail-summary-scroll-msg-up) 725 (define-key rmail-summary-mode-map " " 'rmail-summary-scroll-msg-up)
668 (define-key rmail-summary-mode-map "\177" 'rmail-summary-scroll-msg-down) 726 (define-key rmail-summary-mode-map "\177" 'rmail-summary-scroll-msg-down)
669 (define-key rmail-summary-mode-map "?" 'describe-mode) 727 (define-key rmail-summary-mode-map "?" 'describe-mode)
728 (define-key rmail-summary-mode-map "\C-c\C-n" 'rmail-summary-next-same-subject)
729 (define-key rmail-summary-mode-map "\C-c\C-p" 'rmail-summary-previous-same-subject)
670 (define-key rmail-summary-mode-map "\C-c\C-s\C-d" 730 (define-key rmail-summary-mode-map "\C-c\C-s\C-d"
671 'rmail-summary-sort-by-date) 731 'rmail-summary-sort-by-date)
672 (define-key rmail-summary-mode-map "\C-c\C-s\C-s" 732 (define-key rmail-summary-mode-map "\C-c\C-s\C-s"