Synch with the semi-1_14 branch.
[elisp/semi.git] / mime-view.el
index aae1f93..68a0bc6 100644 (file)
@@ -983,6 +983,7 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
                        (setq buffer-file-name filename)
                        (set-auto-mode))
                    (setq buffer-file-name nil))))
+           (require 'font-lock)
            (let ((font-lock-verbose nil))
              ;; I find font-lock a bit too verbose.
              (font-lock-fontify-buffer))
@@ -1464,6 +1465,8 @@ button-2  Move to point under the mouse cursor
 ;;;
 
 (defun mime-preview-find-boundary-info (&optional get-mother)
+  "Return boundary information of current part.
+If GET-MOTHER, refer boundary surrounding current part and its branches."
   (let (entity
        p-beg p-end
        entity-node-id len)
@@ -1490,7 +1493,6 @@ button-2  Move to point under the mouse cursor
           (setq p-end (point-max)))
          (get-mother
           (save-excursion
-            (goto-char p-end)
             (catch 'tag
               (let (e i)
                 (while (setq e
@@ -1498,12 +1500,14 @@ button-2        Move to point under the mouse cursor
                               (point) 'mime-view-entity))
                   (goto-char e)
                   (let ((rc (mime-entity-node-id
-                             (get-text-property (1- (point))
+                             (get-text-property (point)
                                                 'mime-view-entity))))
                     (or (and (>= (setq i (- (length rc) len)) 0)
                              (equal entity-node-id (nthcdr i rc)))
                         (throw 'tag nil)))
-                  (setq p-end e)))
+                  (setq p-end (or (next-single-property-change
+                                   (point) 'mime-view-entity)
+                                  (point-max)))))
               (setq p-end (point-max))))))
     (vector p-beg p-end entity)))