;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.156 2000/06/15 01:58:02 cph Exp $
+;;; $Id: imail-top.scm,v 1.157 2000/06/15 02:35:27 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
\\[imail-toggle-message] Toggle between standard and raw message formats.")
\f
(define-key 'imail #\a 'imail-add-flag)
+(define-key 'imail #\b 'imail-bury)
(define-key 'imail #\c 'imail-continue)
(define-key 'imail #\d 'imail-delete-forward)
(define-key 'imail #\c-d 'imail-delete-backward)
(define-key 'imail #\space 'scroll-up)
(define-key 'imail #\rubout 'scroll-down)
(define-key 'imail #\? 'describe-mode)
+(define-key 'imail '(#\c-c #\c-n) 'imail-next-same-subject)
+(define-key 'imail '(#\c-c #\c-p) 'imail-previous-same-subject)
;; Putting these after the group above exploits behavior in the comtab
;; abstraction that makes these bindings the ones that show up during
(define-key 'imail #\- 'imail-delete-folder)
;; These commands not yet implemented.
-;;(define-key 'imail #\b 'imail-bury)
;;(define-key 'imail #\m-m 'imail-retry-failure)
;;(define-key 'imail #\w 'imail-output-body-to-file)
;;(define-key 'imail '(#\c-c #\c-s #\c-d) 'imail-sort-by-date)
;;(define-key 'imail '(#\c-c #\c-s #\c-c) 'imail-sort-by-correspondent)
;;(define-key 'imail '(#\c-c #\c-s #\c-l) 'imail-sort-by-lines)
;;(define-key 'imail '(#\c-c #\c-s #\c-k) 'imail-sort-by-keywords)
-;;(define-key 'imail '(#\c-c #\c-n) 'imail-next-same-subject)
-;;(define-key 'imail '(#\c-c #\c-p) 'imail-previous-same-subject)
\f
(define (imail-revert-buffer buffer dont-use-auto-save? dont-confirm?)
dont-use-auto-save?
"p"
(lambda (delta)
((ref-command imail-next-message) (- delta))))
-
+\f
(define-command imail-next-undeleted-message
"Show following non-deleted message.
With prefix argument N, moves forward N non-deleted messages,
"p"
(lambda (delta)
((ref-command imail-next-undeleted-message) (- delta))))
+
+(define-command imail-next-same-subject
+ "Go to the next mail message having the same subject header.
+With prefix argument N, do this N times.
+If N is negative, go backwards instead."
+ "p"
+ (lambda (delta)
+ (let ((get-subject
+ (lambda (m)
+ (let ((subject (get-first-header-field-value m "subject" #f)))
+ (and subject
+ (strip-subject-re (string-trim subject)))))))
+ (let ((subject (get-subject (selected-message))))
+ (if (not subject)
+ (editor-error "Selected message has no subject header."))
+ (move-relative delta
+ (lambda (m)
+ (let ((subject* (get-subject m)))
+ (and subject*
+ (string-ci=? subject subject*))))
+ "message with same subject"
+ #f)))))
+
+(define-command imail-previous-same-subject
+ "Go to the previous mail message having the same subject header.
+With prefix argument N, do this N times.
+If N is negative, go forwards instead."
+ "p"
+ (lambda (delta)
+ ((ref-command imail-next-same-subject) (- delta))))
\f
(define-command imail-next-flagged-message
"Show next message with one of the flags FLAGS.
"Quit out of IMAIL."
()
(lambda ()
- (close-folder (selected-folder))
- ((ref-command bury-buffer))))
+ (let ((folder (selected-folder)))
+ (close-folder folder)
+ (imail-bury folder))))
+(define-command imail-bury
+ "Bury current IMAIL buffer and its summary buffer."
+ ()
+ (lambda ()
+ (imail-bury (selected-folder))))
+
+(define (imail-bury folder)
+ (let ((folder-buffer (imail-folder->buffer folder #t)))
+ (for-each
+ (lambda (buffer)
+ (if (buffer-alive? buffer)
+ (let ((buffer* (other-buffer buffer)))
+ (for-each (lambda (window)
+ (if (window-has-no-neighbors? window)
+ (if buffer*
+ (select-buffer-in-window buffer* window #f))
+ (window-delete! window)))
+ (buffer-windows buffer))
+ (bury-buffer buffer))))
+ (buffer-get folder-buffer 'IMAIL-ASSOCIATED-BUFFERS '()))
+ (let ((buffer (other-buffer folder-buffer)))
+ (if buffer
+ (for-each (lambda (window)
+ (select-buffer-in-window buffer window #f))
+ (buffer-windows folder-buffer))))
+ (bury-buffer folder-buffer)))
+\f
(define-command imail-get-new-mail
"Probe the mail server for new mail.
Selects the first new message if any new mail.
;;; -*-Scheme-*-
;;;
-;;; $Id: imail.pkg,v 1.58 2000/06/15 01:57:48 cph Exp $
+;;; $Id: imail.pkg,v 1.59 2000/06/15 02:35:54 cph Exp $
;;;
;;; Copyright (c) 2000 Massachusetts Institute of Technology
;;;
(export (edwin)
edwin-command$imail
edwin-command$imail-add-flag
+ edwin-command$imail-bury
edwin-command$imail-continue
edwin-command$imail-copy-folder
edwin-command$imail-copy-messages
edwin-command$imail-mail
edwin-command$imail-next-flagged-message
edwin-command$imail-next-message
+ edwin-command$imail-next-same-subject
edwin-command$imail-next-undeleted-message
edwin-command$imail-output
edwin-command$imail-previous-flagged-message
edwin-command$imail-previous-message
+ edwin-command$imail-previous-same-subject
edwin-command$imail-previous-undeleted-message
edwin-command$imail-quit
edwin-command$imail-rename-folder