From b941303618d6e4bb6c9f5797b817a536e1c64035 Mon Sep 17 00:00:00 2001 From: morioka Date: Sat, 14 Mar 1998 23:04:31 +0000 Subject: [PATCH] (mime-raw-point-to-entity-node-id): Use `mime-raw-find-entity-from-point'. (mime-raw-point-to-entity-number): Likewise. --- mime-view.el | 66 +++++++++++++++++++++------------------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/mime-view.el b/mime-view.el index cba3b3c..df61c09 100644 --- a/mime-view.el +++ b/mime-view.el @@ -617,35 +617,29 @@ The compressed face will be piped to this command.") ;;; @ entity information ;;; -(defun mime-raw-point-to-entity-number (position &optional message-info) - "Return entity-number from POTION in mime-raw-buffer. +(defsubst mime-raw-find-entity-from-node-id (entity-node-id + &optional message-info) + "Return entity from ENTITY-NODE-ID in mime-raw-buffer. If optional argument MESSAGE-INFO is not specified, `mime-raw-message-info' is used." - (or message-info - (setq message-info mime-raw-message-info)) - (let ((b (mime-entity-point-min message-info)) - (e (mime-entity-point-max message-info)) - (c (mime-entity-children message-info)) - ) - (if (and (<= b position)(<= position e)) - (or (let (entity ret (sn 0)) - (catch 'tag - (while c - (setq entity (car c)) - (setq ret (mime-raw-point-to-entity-number position entity)) - (cond ((eq ret t) (throw 'tag (list sn))) - (ret (throw 'tag (cons sn ret))) - ) - (setq c (cdr c)) - (setq sn (1+ sn)) - ))) - t)))) + (mime-raw-find-entity-from-number (reverse entity-node-id) message-info)) -(defun mime-raw-point-to-entity-node-id (position &optional message-info) - "Return entity-node-id from POTION in mime-raw-buffer. +(defun mime-raw-find-entity-from-number (entity-number &optional message-info) + "Return entity from ENTITY-NUMBER in mime-raw-buffer. If optional argument MESSAGE-INFO is not specified, `mime-raw-message-info' is used." - (reverse (mime-raw-point-to-entity-number position message-info))) + (or message-info + (setq message-info mime-raw-message-info)) + (if (eq entity-number t) + message-info + (let ((sn (car entity-number))) + (if (null sn) + message-info + (let ((rc (nth sn (mime-entity-children message-info)))) + (if rc + (mime-raw-find-entity-from-number (cdr entity-number) rc) + )) + )))) (defun mime-raw-find-entity-from-point (point &optional message-info) "Return entity from POINT in mime-raw-buffer. @@ -666,29 +660,17 @@ If optional argument MESSAGE-INFO is not specified, (setq children (cdr children))) message-info)))) -(defsubst mime-raw-find-entity-from-node-id (entity-node-id - &optional message-info) - "Return entity from ENTITY-NODE-ID in mime-raw-buffer. +(defsubst mime-raw-point-to-entity-node-id (point &optional message-info) + "Return entity-node-id from POINT in mime-raw-buffer. If optional argument MESSAGE-INFO is not specified, `mime-raw-message-info' is used." - (mime-raw-find-entity-from-number (reverse entity-node-id) message-info)) + (mime-entity-node-id (mime-raw-find-entity-from-point point message-info))) -(defun mime-raw-find-entity-from-number (entity-number &optional message-info) - "Return entity from ENTITY-NUMBER in mime-raw-buffer. +(defsubst mime-raw-point-to-entity-number (point &optional message-info) + "Return entity-number from POINT in mime-raw-buffer. If optional argument MESSAGE-INFO is not specified, `mime-raw-message-info' is used." - (or message-info - (setq message-info mime-raw-message-info)) - (if (eq entity-number t) - message-info - (let ((sn (car entity-number))) - (if (null sn) - message-info - (let ((rc (nth sn (mime-entity-children message-info)))) - (if rc - (mime-raw-find-entity-from-number (cdr entity-number) rc) - )) - )))) + (reverse (mime-raw-point-to-entity-node-id point message-id))) (defun mime-raw-flatten-message-info (&optional message-info) "Return list of entity in mime-raw-buffer. -- 1.7.10.4