From: yoichi Date: Wed, 15 Sep 2004 15:11:37 +0000 (+0000) Subject: * mime-view.el (mime-preview-follow-current-entity): Avoid error X-Git-Tag: semi-1_14-wl-root~37 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92b1d375c0ffd9da64a60133fe8a4c8cb4fdbdea;p=elisp%2Fsemi.git * mime-view.el (mime-preview-follow-current-entity): Avoid error on null entity. (mime-preview-find-boundary-info): Ditto. Avoid error at the beginning of buffer. --- diff --git a/ChangeLog b/ChangeLog index e1bd01d..c419972 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-09-15 Yoichi NAKAYAMA + + * mime-view.el (mime-preview-follow-current-entity): Avoid error + on null entity. + (mime-preview-find-boundary-info): Ditto. + Avoid error at the beginning of buffer. + 2004-08-28 Yoichi NAKAYAMA * pgg-pgp5.el (pgg-scheme-verify-region): `let*' -> `let'. diff --git a/mime-view.el b/mime-view.el index 10b945f..cd0e80a 100644 --- a/mime-view.el +++ b/mime-view.el @@ -1478,11 +1478,13 @@ If WITH-CHILDREN, refer boundary surrounding current part and its branches." (let (entity p-beg p-end entity-node-id len) - (while (null (setq entity - (get-text-property (point) 'mime-view-entity))) + (while (and + (null (setq entity + (get-text-property (point) 'mime-view-entity))) + (> (point) (point-min))) (backward-char)) (setq p-beg (previous-single-property-change (point) 'mime-view-entity)) - (setq entity-node-id (mime-entity-node-id entity)) + (setq entity-node-id (and entity (mime-entity-node-id entity))) (setq len (length entity-node-id)) (cond ((null p-beg) (setq p-beg @@ -1558,13 +1560,13 @@ It decodes current entity to call internal or external method as It calls following-method selected from variable `mime-preview-following-method-alist'." (interactive) - (let ((entity (mime-preview-find-boundary-info t)) - p-beg p-end - pb-beg) - (setq p-beg (aref entity 0) - p-end (aref entity 1) - entity (aref entity 2)) - (if (get-text-property p-beg 'mime-view-entity-body) + (let* ((boundary-info (mime-preview-find-boundary-info t)) + (p-beg (aref boundary-info 0)) + (p-end (aref boundary-info 1)) + (entity (aref boundary-info 2)) + pb-beg) + (if (or (get-text-property p-beg 'mime-view-entity-body) + (null entity)) (setq pb-beg p-beg) (setq pb-beg (next-single-property-change @@ -1572,7 +1574,7 @@ It calls following-method selected from variable (or (next-single-property-change p-beg 'mime-view-entity) p-end)))) (let* ((mode (mime-preview-original-major-mode 'recursive)) - (entity-node-id (mime-entity-node-id entity)) + (entity-node-id (and entity (mime-entity-node-id entity))) (new-name (format "%s-%s" (buffer-name) (reverse entity-node-id))) new-buf @@ -1585,7 +1587,8 @@ It calls following-method selected from variable (insert-buffer-substring the-buf pb-beg p-end) (goto-char (point-min)) (let ((current-entity - (if (and (eq (mime-entity-media-type entity) 'message) + (if (and entity + (eq (mime-entity-media-type entity) 'message) (eq (mime-entity-media-subtype entity) 'rfc822)) (car (mime-entity-children entity)) entity)))