Delete imail-auto-summary feature. Instead implement
authorChris Hanson <org/chris-hanson/cph>
Thu, 26 Oct 2000 05:07:27 +0000 (05:07 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 26 Oct 2000 05:07:27 +0000 (05:07 +0000)
imail-summary-fixed-layout feature that uses new buffer-layout
mechanism.

v7/src/imail/imail-summary.scm
v7/src/imail/imail-top.scm
v7/src/imail/imail.pkg

index 48c79745513da15b00b17921e80daaa94d04a2fe..2563903071aab2c08fdb90ff6ac5ef8e1e5091fc 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-summary.scm,v 1.28 2000/10/20 04:33:20 cph Exp $
+;;; $Id: imail-summary.scm,v 1.29 2000/10/26 05:07:04 cph Exp $
 ;;;
 ;;; Copyright (c) 2000 Massachusetts Institute of Technology
 ;;;
@@ -52,6 +52,15 @@ A real number between 0 and 1 exclusive means a fraction of the screen height."
   (lambda (x)
     (or (and (exact-integer? x) (positive? x))
        (and (real? x) (< 0 x 1)))))
+
+(define-variable imail-summary-fixed-layout
+  "If true, summary buffer is linked to folder buffer in fixed layout.
+Selecting either buffer causes both to be selected,
+ in a standard window configuration.
+Once selected, selecting another buffer causes the window configuration
+ to be restored to a single window."
+  #f
+  boolean?)
 \f
 (define-command imail-summary
   "Display a summary of the selected folder, one line per message."
@@ -157,7 +166,16 @@ SUBJECT is a string of regexps separated by commas."
              (select-window (car windows))
              (select-buffer buffer))))
     (preload-folder-outlines folder)
-    (rebuild-imail-summary-buffer buffer)))
+    (rebuild-imail-summary-buffer buffer)
+    (if (ref-variable imail-summary-fixed-layout buffer)
+       (begin
+         (delete-buffer-layout buffer)
+         (create-buffer-layout
+          (lambda (window buffers)
+            (let ((buffer (car buffers)))
+              (select-buffer buffer window)
+              (imail-summary-pop-up-message-buffer buffer window)))
+          (list buffer folder-buffer))))))
 
 (define (imail-summary-detach buffer)
   (let ((folder-buffer (buffer-get buffer 'IMAIL-FOLDER-BUFFER #f)))
@@ -461,18 +479,22 @@ SUBJECT is a string of regexps separated by commas."
   (if (ref-variable imail-summary-pop-up-message buffer)
       (imail-summary-pop-up-message-buffer buffer)))
 
-(define (imail-summary-pop-up-message-buffer buffer)
-  (let ((folder-buffer (buffer-get buffer 'IMAIL-FOLDER-BUFFER #f)))
+(define (imail-summary-pop-up-message-buffer buffer #!optional window)
+  (let ((folder-buffer (buffer-get buffer 'IMAIL-FOLDER-BUFFER #f))
+       (window
+        (if (or (default-object? window) (not window))
+            (selected-window)
+            window)))
     (if (and folder-buffer (selected-buffer? buffer))
        (pop-up-buffer folder-buffer #f
-                      `((HEIGHT
-                         ,(let ((height
-                                 (ref-variable imail-summary-height buffer)))
-                            (if (exact-integer? height)
-                                height
-                                (round->exact
-                                 (* (window-y-size (selected-window))
-                                    height))))))))))
+                      `((HEIGHT ,(imail-summary-height buffer window))
+                        (SCREEN ,(window-screen window)))))))
+
+(define (imail-summary-height buffer window)
+  (let ((height (ref-variable imail-summary-height buffer)))
+    (if (exact-integer? height)
+       height
+       (round->exact (* (window-y-size window) height)))))
 \f
 (define (sync-imail-summary-buffer buffer)
   (let ((message
index 1a756ddec44644d7b116c0189249c66ca1877132..592b40c7f0796c9d36e1675ecfed8ec4def96e06 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-top.scm,v 1.217 2000/10/26 02:31:12 cph Exp $
+;;; $Id: imail-top.scm,v 1.218 2000/10/26 05:07:27 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
@@ -192,15 +192,6 @@ Otherwise, only one of the parts is shown."
 Otherwise, only the IMAIL buffer for that folder has an indicator."
   #t
   boolean?)
-
-(define-variable imail-auto-summary
-  "If true, selecting an imail buffer automatically selects its summary.
-The variable can take three values:
-#F means no auto-selection is done.
-#T means select the summary only if it already exists.
-CREATE means always select the summary, creating it if needed."
-  #f
-  (lambda (x) (or (boolean? x) (eq? x 'CREATE))))
 \f
 (define-command imail
   "Read and edit incoming mail.
@@ -289,7 +280,6 @@ regardless of the folder type."
   (lambda (buffer)
     (buffer-put! buffer 'REVERT-BUFFER-METHOD imail-revert-buffer)
     (add-kill-buffer-hook buffer imail-kill-buffer)
-    ;;(add-pre-select-buffer-hook buffer imail-pre-select-buffer-hook)
     (buffer-put! buffer 'MAIL-YANK-ORIGINAL-METHOD imail-yank-original)
     (local-set-variable! mode-line-modified "--- " buffer)
     (imail-adjust-adaptive-fill buffer)
@@ -297,7 +287,7 @@ regardless of the folder type."
     (set-buffer-read-only! buffer)
     (disable-group-undo! (buffer-group buffer))
     (event-distributor/invoke! (ref-variable imail-mode-hook buffer) buffer)))
-\f
+
 (define-variable imail-mode-hook
   "An event distributor that is invoked when entering IMAIL mode."
   (make-event-distributor))
@@ -316,30 +306,6 @@ regardless of the folder type."
    (string-append regexp "\\|"
                  (ref-variable adaptive-fill-first-line-regexp #f))
    buffer))
-
-(define (imail-pre-select-buffer-hook buffer window select continue)
-  (let ((auto-summary (ref-variable imail-auto-summary buffer)))
-    (if (and auto-summary (null? (buffer-windows buffer)))
-       (let ((folder (selected-folder #f buffer)))
-         (if folder
-             (let ((folder-buffer (imail-folder->buffer folder #f))
-                   (summary-buffer (imail-folder->summary-buffer folder #f)))
-               (if (and folder-buffer
-                        (or (eq? buffer folder-buffer)
-                            (eq? buffer summary-buffer))
-                        (null? (buffer-windows folder-buffer))
-                        (if summary-buffer
-                            (null? (buffer-windows summary-buffer))
-                            (eq? auto-summary 'CREATE)))
-                   (begin
-                     (select)          ;finish pending selection
-                     (delete-other-windows window)
-                     (if (eq? buffer folder-buffer)
-                         ((ref-command imail-summary))
-                         (imail-summary-pop-up-message-buffer buffer)))
-                   (continue)))
-             (continue)))
-       (continue))))
 \f
 (define imail-mode-description
   "IMAIL mode is used by \\[imail] for editing mail folders.
@@ -1391,8 +1357,7 @@ If it doesn't exist, it is created first."
           (let ((buffer* (other-buffer buffer)))
             (for-each (lambda (window)
                         (if (window-has-no-neighbors? window)
-                            (if buffer*
-                                (select-buffer-in-window buffer* window #f))
+                            (if buffer* (select-buffer buffer* window))
                             (window-delete! window)))
                       (buffer-windows buffer))
             (bury-buffer buffer))))
@@ -1400,7 +1365,7 @@ If it doesn't exist, it is created first."
     (let ((buffer (other-buffer folder-buffer)))
       (if buffer
          (for-each (lambda (window)
-                     (select-buffer-in-window buffer window #f))
+                     (select-buffer buffer window))
                    (buffer-windows folder-buffer))))
     (bury-buffer folder-buffer)))
 
index 44713ab6b91cb3a1babd17c584886ed47232dc6e..8795cba854b29fb24e4c701f5b3754bd78d23414 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail.pkg,v 1.76 2000/10/20 04:35:46 cph Exp $
+;;; $Id: imail.pkg,v 1.77 2000/10/26 05:07:24 cph Exp $
 ;;;
 ;;; Copyright (c) 2000 Massachusetts Institute of Technology
 ;;;
          edwin-command$imail-undelete-forward
          edwin-command$imail-undelete-previous-message
          edwin-mode$imail
-         edwin-variable$imail-auto-summary
          edwin-variable$imail-auto-wrap
          edwin-variable$imail-body-cache-limit
          edwin-variable$imail-default-dont-reply-to-names
          edwin-command$imail-summary-by-topic
          edwin-command$imail-summary-select-message
          edwin-mode$imail-summary
+         edwin-variable$imail-summary-fixed-layout
          edwin-variable$imail-summary-height
          edwin-variable$imail-summary-highlight-message
          edwin-variable$imail-summary-mode-hook
          edwin-variable$imail-summary-show-date
          edwin-variable$imail-summary-subject-width)
   (export (edwin imail front-end)
-         imail-folder->summary-buffer
-         imail-summary-pop-up-message-buffer
          write-imail-summary-line!))
\ No newline at end of file