From 49a617c5e1e4065e989c1c37dc003a5b3c8ffe5a Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 31 Oct 2000 08:07:26 +0000 Subject: [PATCH] * mime-edit.el (mime-edit-insert-voice): Add text-property `mime-edit-invisible'. (mime-edit-insert-binary-file): Ditto. (mime-edit-content-end): Check text-property `mime-edit-invisible' instead of `invisible'. (mime-edit-invisible-region): New function. (mime-edit-invisible-p): New function. (mime-edit-next-visible-point): New function. --- ChangeLog | 11 +++++++++++ mime-edit.el | 46 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8690bed..e6d2dd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-10-31 Daiki Ueno + + * mime-edit.el (mime-edit-insert-voice): Add text-property + `mime-edit-invisible'. + (mime-edit-insert-binary-file): Ditto. + (mime-edit-content-end): Check text-property `mime-edit-invisible' + instead of `invisible'. + (mime-edit-invisible-region): New function. + (mime-edit-invisible-p): New function. + (mime-edit-next-visible-point): New function. + 2000-10-19 Takanori Saneto * pgg-pgp.el (pgg-pgp-process-region): bind process-environment diff --git a/mime-edit.el b/mime-edit.el index 2553c4f..027eeb5 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -1021,7 +1021,7 @@ just return to previous mode." (if (and (featurep 'xemacs) (featurep 'menubar)) (delete-menu-item (list mime-edit-menu-title))) - (end-of-invisible) + (disable-invisible) (set-buffer-modified-p (buffer-modified-p)) (run-hooks 'mime-edit-exit-hook) (message "Exit MIME editor mode."))) @@ -1136,7 +1136,7 @@ If optional argument SUBTYPE is not nil, text/SUBTYPE tag is inserted." (funcall mime-edit-voice-recorder encoding) (progn (insert "\n") - (invisible-region (point-min)(point-max)) + (mime-edit-invisible-region (point-min)(point-max)) (goto-char (point-max))))))) (defun mime-edit-insert-signature (&optional arg) @@ -1205,6 +1205,42 @@ If nothing is inserted, return nil." nil ;Nothing is created. ))) +(defun mime-edit-invisible-region (start end) + (invisible-region start end) ;`invisible-region' might be overridden + (static-if (featurep 'xemacs) + (if (save-excursion + (goto-char start) + (eq (following-char) ?\n)) + (setq start (1+ start))) + (if (save-excursion + (goto-char (1- end)) + (eq (following-char) ?\n)) + (setq end (1- end)))) + (put-text-property start end mime-edit-invisible t)) + +(defun mime-edit-invisible-p (pos) + (static-when (featurep 'xemacs) + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n)) + (setq pos (1+ pos)))) + (get-text-property pos 'mime-edit-invisible)) + +(defun mime-edit-next-visible-point (pos) + (static-if (featurep 'xemacs) + (save-excursion + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n)) + (setq pos (1+ pos))) + (or (next-single-property-change pos 'mime-edit-invisible) + (point-max))) + (save-excursion + (goto-char (next-single-property-change pos 'mime-edit-invisible)) + (if (eq (following-char) ?\n) + (forward-char)) + (point)))) + (defun mime-edit-insert-binary-file (file &optional encoding) "Insert binary FILE at point. Optional argument ENCODING specifies an encoding method such as base64." @@ -1221,7 +1257,7 @@ Optional argument ENCODING specifies an encoding method such as base64." (mime-insert-encoded-file file encoding) (if hide-p (progn - (invisible-region (point-min) (point-max)) + (mime-edit-invisible-region (point-min) (point-max)) (goto-char (point-max))) (goto-char (point-max)))) (or hide-p @@ -1283,8 +1319,8 @@ Optional argument ENCODING specifies an encoding method such as base64." (if (mime-edit-goto-tag) (progn (goto-char (match-end 0)) - (if (invisible-p (point)) - (next-visible-point (point)) + (if (mime-edit-invisible-p (point)) + (mime-edit-next-visible-point (point)) ;; Move to the end of this text. (if (re-search-forward mime-edit-tag-regexp nil 'move) ;; Don't forget a multiline tag. -- 1.7.10.4