add iso-8859-14 also
[elisp/semi.git] / mime-view.el
index 64a4d10..81386cb 100644 (file)
@@ -421,7 +421,8 @@ mother-buffer."
 (defun mime-save-situation-examples ()
   (if (or mime-preview-situation-example-list
          mime-acting-situation-example-list)
-      (let ((file mime-situation-examples-file))
+      (let ((file mime-situation-examples-file)
+           print-length print-level)
        (with-temp-buffer
          (insert ";;; " (file-name-nondirectory file) "\n")
          (insert "\n;; This file is generated automatically by "
@@ -438,7 +439,7 @@ mother-buffer."
          (insert "\n;;; "
                  (file-name-nondirectory file)
                  " ends here.\n")
-          (static-cond
+         (static-cond
           ((boundp 'buffer-file-coding-system)
            (setq buffer-file-coding-system
                  mime-situation-examples-file-coding-system))
@@ -446,7 +447,7 @@ mother-buffer."
            (setq file-coding-system
                  mime-situation-examples-file-coding-system)))
          ;; (setq buffer-file-coding-system
-          ;;       mime-situation-examples-file-coding-system)
+         ;;       mime-situation-examples-file-coding-system)
          (setq buffer-file-name file)
          (save-buffer)))))
 
@@ -1472,7 +1473,9 @@ button-2  Move to point under the mouse cursor
 ;;; @@ utility
 ;;;
 
-(defun mime-preview-find-boundary-info (&optional get-mother)
+(defun mime-preview-find-boundary-info (&optional with-children)
+  "Return boundary information of current part.
+If WITH-CHILDREN, refer boundary surrounding current part and its branches."
   (let (entity
        p-beg p-end
        entity-node-id len)
@@ -1501,9 +1504,8 @@ button-2  Move to point under the mouse cursor
          ((null entity-node-id)
           (setq p-end (point-max))
           )
-         (get-mother
+         (with-children
           (save-excursion
-            (goto-char p-end)
             (catch 'tag
               (let (e i)
                 (while (setq e
@@ -1511,12 +1513,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)))
@@ -1623,9 +1627,8 @@ It calls following-method selected from variable
        (if (functionp f)
            (funcall f new-buf)
          (message
-          (format
-           "Sorry, following method for %s is not implemented yet."
-           mode))
+          "Sorry, following method for %s is not implemented yet."
+          mode)
          ))
       )))
 
@@ -1802,7 +1805,7 @@ If LINES is negative, scroll up LINES lines."
 ;;;
 
 (defun mime-preview-toggle-display (type &optional display)
-  (let ((situation (mime-preview-find-boundary-info))
+  (let ((situation (mime-preview-find-boundary-info t))
        (sym (intern (concat "*" (symbol-name type))))
        entity p-beg p-end)
     (setq p-beg (aref situation 0)