From: yamaoka Date: Tue, 13 Mar 2001 03:49:42 +0000 (+0000) Subject: * message.el (message-fix-before-sending): Hide again the invisible property X-Git-Tag: t-gnus-6_15_0-10-quimby~14 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83551aac8faa5ef54839f79dfc3bd2fd5a8175dd;p=elisp%2Fgnus.git- * message.el (message-fix-before-sending): Hide again the invisible property of encoded binary data parts after checking is done. (message-find-invisible-regions): New function. (message-save-drafts, message-send): Inherit the invisible property of encoded binary data parts to make MIME-Edit find the MIME part boundaries. * dgnushack.el (dgnushack-compose-package): Tidy up. (dgnushack-make-load): Ditto. --- diff --git a/ChangeLog b/ChangeLog index f78bce4..3afd035 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-03-13 Katsumi Yamaoka + + * lisp/message.el (message-fix-before-sending): Hide again the + invisible property of encoded binary data parts after checking is + done. + (message-find-invisible-regions): New function. + (message-save-drafts, message-send): Inherit the invisible property + of encoded binary data parts to make MIME-Edit find the MIME part + boundaries. + + * lisp/dgnushack.el (dgnushack-compose-package): Tidy up. + (dgnushack-make-load): Ditto. + 2001-03-12 Katsumi Yamaoka * lisp/dgnushack.el (dgnushack-compose-package): New function. diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index 176f601..44d9ccd 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -412,8 +412,9 @@ Modify to suit your needs.")) (search-forward ";;; Code:") (forward-line) (delete-region (point-min) (point)) - (unless (re-search-forward - "^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]" nil t) + (unless (re-search-forward "\ +^[\t ]*(autoload[\t\n ]+\\('\\|(quote[\t\n ]+\\)custom-add-loads[\t\n ]" + nil t) (insert "\n(autoload 'custom-add-loads \"cus-load\")\n")) (goto-char (point-min)) (insert "\ @@ -466,10 +467,11 @@ Modify to suit your needs.")) (defun dgnushack-compose-package () "Re-split the file gnus-load.el into custom-load.el and auto-autoloads.el. It is silly, should be improved!" - (message "\ + (message " Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...") (let ((customload (expand-file-name "custom-load.el" srcdir)) - (autoloads (expand-file-name "auto-autoloads.el" srcdir))) + (autoloads (expand-file-name "auto-autoloads.el" srcdir)) + start) (with-temp-buffer (insert-file-contents dgnushack-gnus-load-file) (delete-file dgnushack-gnus-load-file) @@ -478,7 +480,7 @@ Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...") (while (prog1 (looking-at "[\t ;]") (forward-line 1))) - (delete-region (point-min) (point)) + (setq start (point)) (insert "\ ;;; custom-load.el --- automatically extracted custom dependencies\n ;;; Code:\n\n") @@ -489,10 +491,10 @@ Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...") (forward-list 1) (forward-line 1) (insert "\n;;; custom-load.el ends here\n") - (write-region (point-min) (point) customload) + (write-region start (point) customload) (while (looking-at "[\t ]*$") (forward-line 1)) - (delete-region (point-min) (point)) + (setq start (point)) (if (re-search-forward "^[\t\n ]*(if[\t\n ]+(featurep[\t\n ]" nil t) (let ((from (goto-char (match-beginning 0)))) (delete-region from (progn @@ -506,13 +508,13 @@ Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...") (while (progn (forward-line -1) (not (looking-at "[\t ]*(provide[\t\n ]")))) - (delete-region (point) (point-max)) (insert "(provide 'gnus-autoloads)\n") - (write-region (point-min) (point) autoloads)) + (write-region start (point) autoloads)) (byte-compile-file customload) (byte-compile-file autoloads)) (message "\ -Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done")) +Re-splitting gnus-load.el into custom-load.el and auto-autoloads.el...done +\n")) (defconst dgnushack-info-file-regexp-en diff --git a/lisp/message.el b/lisp/message.el index 7ac94c7..f8a6f2d 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -2847,8 +2847,15 @@ It should typically alter the sending method in some way or other." (set-buffer message-encoding-buffer) (erase-buffer) ;; Avoid copying text props. - (insert (with-current-buffer message-edit-buffer - (buffer-substring-no-properties (point-min) (point-max)))) + (let (message-invisibles) + (insert + (with-current-buffer message-edit-buffer + (setq message-invisibles (message-find-invisible-regions)) + (buffer-substring-no-properties (point-min) (point-max)))) + ;; Inherit the invisible property of texts to make MIME-Edit + ;; find the MIME part boundaries. + (dolist (region message-invisibles) + (put-text-property (car region) (cdr region) 'invisible t))) (funcall message-encode-function) (while (and success (setq elem (pop alist))) @@ -2918,6 +2925,20 @@ It should typically alter the sending method in some way or other." (eval-after-load "invisible" '(defalias 'invisible-region 'message-invisible-region)) +(defun message-find-invisible-regions () + "Find invisible texts with the property `message-invisible' and +return a list of points." + (let (from + (to (point-min)) + regions) + (while (setq from (text-property-any to (point-max) + 'message-invisible t)) + (setq to (or (text-property-not-all from (point-max) + 'message-invisible t) + (point-max))) + (push (cons from to) regions)) + regions)) + (defun message-fix-before-sending () "Do various things to make the message nice before sending it." ;; Make sure there's a newline at the end of the message. @@ -2927,21 +2948,20 @@ It should typically alter the sending method in some way or other." (insert "\n")) ;; Expose all invisible text with the property `message-invisible'. ;; We should believe that the things might be created by MIME-Edit. - (let (start) - (while (setq start (text-property-any (point-min) (point-max) - 'message-invisible t)) - (remove-text-properties start - (or (text-property-not-all start (point-max) - 'message-invisible t) - (point-max)) - '(invisible nil message-invisible nil)))) - ;; Expose all invisible text. - (message-check 'invisible-text - (when (text-property-any (point-min) (point-max) 'invisible t) - (put-text-property (point-min) (point-max) 'invisible nil) - (unless (yes-or-no-p - "Invisible text found and made visible; continue posting? ") - (error "Invisible text found and made visible"))))) + (let ((message-invisibles (message-find-invisible-regions))) + (dolist (region message-invisibles) + (put-text-property (car region) (cdr region) 'invisible nil)) + ;; Expose all invisible text. + (message-check 'invisible-text + (when (text-property-any (point-min) (point-max) 'invisible t) + (put-text-property (point-min) (point-max) 'invisible nil) + (unless (yes-or-no-p + "Invisible text found and made visible; continue posting? ") + (error "Invisible text found and made visible")))) + ;; Hide again all text with the property `message-invisible'. + ;; It is needed to make MIME-Edit find the MIME part boundaries. + (dolist (region message-invisibles) + (put-text-property (car region) (cdr region) 'invisible t)))) (defun message-add-action (action &rest types) "Add ACTION to be performed when doing an exit of type TYPES." @@ -5831,9 +5851,14 @@ regexp varstr." (interactive) (message "Saving %s..." buffer-file-name) (let ((reply-headers message-reply-headers) - (msg (buffer-substring-no-properties (point-min) (point-max)))) + (msg (buffer-substring-no-properties (point-min) (point-max))) + (message-invisibles (message-find-invisible-regions))) (with-temp-file buffer-file-name (insert msg) + ;; Inherit the invisible property of texts to make MIME-Edit + ;; find the MIME part boundaries. + (dolist (region message-invisibles) + (put-text-property (car region) (cdr region) 'invisible t)) (setq message-reply-headers reply-headers) (message-generate-headers '((optional . In-Reply-To))) (mime-edit-translate-buffer))