From ced30a4916088e91f19af245bcc58280d97ade07 Mon Sep 17 00:00:00 2001
From: Chris Hanson <org/chris-hanson/cph>
Date: Wed, 24 Jan 2001 22:53:47 +0000
Subject: [PATCH] Use new MIME-BODY-ENCLOSED? and SPECIFIC-PROPERTY-REGION to
 properly compute the buffer region associated with a compound MIME entity. 
 The problem is that the IMAIL-MIME-INFO text property associated with parts
 of the region will be that of subentities of the entity, so it's necessary to
 use the enclosure information to determine this.

---
 v7/src/imail/imail-top.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm
index 2c70cda96..6cc38cd2b 100644
--- a/v7/src/imail/imail-top.scm
+++ b/v7/src/imail/imail-top.scm
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-top.scm,v 1.231 2001/01/24 19:17:36 cph Exp $
+;;; $Id: imail-top.scm,v 1.232 2001/01/24 22:53:47 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2001 Massachusetts Institute of Technology
 ;;;
@@ -903,8 +903,10 @@ With prefix argument, prompt even when point is on an attachment."
 
 (define (toggle-mime-entity info mark message)
   (set-mime-info-expanded?! info (not (mime-info-expanded? info)))
-  (let ((region (specific-property-region mark 'IMAIL-MIME-INFO))
+  (let ((region (mime-entity-region mark))
 	(buffer (mark-buffer mark)))
+    (if (not region)
+	(error "No MIME entity at mark:" mark))
     (let ((point (mark-right-inserting-copy (buffer-point buffer))))
       (with-read-only-defeated mark
 	(lambda ()
@@ -2383,6 +2385,11 @@ Negative argument means search in reverse."
 	    (loop mark attachments)
 	    (reverse! attachments))))))
 
+(define (mime-entity-region mark)
+  (specific-property-region mark 'IMAIL-MIME-INFO
+    (lambda (i1 i2)
+      (mime-body-enclosed? (mime-info-body i1) (mime-info-body i2)))))
+
 (define (mime-attachment? info)
   (not (mime-info-inline? info)))
 
-- 
2.25.1