* mime.el (mime-find-root-entity): Find root entity recursively.
[elisp/flim.git] / mime.el
diff --git a/mime.el b/mime.el
index 2160569..56bdb1b 100644 (file)
--- a/mime.el
+++ b/mime.el
@@ -144,10 +144,9 @@ If MESSAGE is specified, it is regarded as root entity."
 
 (defun mime-find-root-entity (entity)
   "Return root entity of ENTITY."
-  (let ((p (mime-entity-parent entity)))
-    (if (null p)
-       entity
-      (mime-entity-parent p))))
+  (while (not (mime-root-entity-p entity))
+    (setq entity (mime-entity-parent entity)))
+  entity)
 
 
 ;;; @ Header buffer (obsolete)