changeset 64693:6bf3cc5c6ab3

Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 99) - Update from CVS 2005-07-29 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (gnus-article-next-page-1): Reduce the number of lines to scroll rather than to stop it. * lisp/gnus/mml.el (mml-generate-default-type): Add doc string. (mml-generate-mime-1): Use mm-default-file-encoding or make it default to application/octet-stream when determining the content type if it is not specified for the part or the mml contents; add a comment about mml-generate-default-type. 2005-07-29 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/mml.el (mml-generate-mime-1): Use mm-default-file-encoding or make it default to application/octet-stream when determining the content type if it is not specified for the external contents. 2005-07-27 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/mm-decode.el (mm-display-external): Delete temp file, directory and buffer immediately if the external process is exited.
author Miles Bader <miles@gnu.org>
date Sun, 31 Jul 2005 00:12:23 +0000
parents 277ec4e94237
children 737cccaeefe5
files lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/mm-decode.el lisp/gnus/mml.el
diffstat 4 files changed, 99 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Sat Jul 30 19:04:19 2005 +0000
+++ b/lisp/gnus/ChangeLog	Sun Jul 31 00:12:23 2005 +0000
@@ -1,8 +1,30 @@
+2005-07-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (gnus-article-next-page-1): Reduce the number of
+	lines to scroll rather than to stop it.
+
+	* mml.el (mml-generate-default-type): Add doc string.
+	(mml-generate-mime-1): Use mm-default-file-encoding or make it
+	default to application/octet-stream when determining the content
+	type if it is not specified for the part or the mml contents; add
+	a comment about mml-generate-default-type.
+
+2005-07-29  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* mml.el (mml-generate-mime-1): Use mm-default-file-encoding or
+	make it default to application/octet-stream when determining the
+	content type if it is not specified for the external contents.
+
 2005-07-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* rfc2231.el (rfc2231-parse-string): Take care that not only a
 	segmented parameter but also other parameters might be there.
 
+2005-07-27  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mm-decode.el (mm-display-external): Delete temp file, directory
+	and buffer immediately if the external process is exited.
+
 2005-07-26  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (gnus-article-next-page-1): Don't scroll if there're
--- a/lisp/gnus/gnus-art.el	Sat Jul 30 19:04:19 2005 +0000
+++ b/lisp/gnus/gnus-art.el	Sun Jul 31 00:12:23 2005 +0000
@@ -5197,17 +5197,23 @@
 			 1 0)))))))
 
 (defun gnus-article-next-page-1 (lines)
-  (unless (and (not (featurep 'xemacs))
-	       (> (symbol-value 'scroll-margin) 0)
-	       (<= (count-lines (window-start) (point-max))
-		   (symbol-value 'scroll-margin)))
-    (condition-case ()
-	(let ((scroll-in-place nil))
-	  (scroll-up lines))
-      (end-of-buffer
-       ;; Long lines may cause an end-of-buffer error.
-       (goto-char (point-max))))
-    (gnus-article-beginning-of-window)))
+  (when (and (not (featurep 'xemacs))
+	     (numberp lines)
+	     (> lines 0)
+	     (numberp (symbol-value 'scroll-margin))
+	     (> (symbol-value 'scroll-margin) 0))
+    ;; Protect against the bug that Emacs 21.x hangs up when scrolling up for
+    ;; too many number of lines if `scroll-margin' is set as two or greater.
+    (setq lines (min lines
+		     (max 0 (- (count-lines (window-start) (point-max))
+			       (symbol-value 'scroll-margin))))))
+  (condition-case ()
+      (let ((scroll-in-place nil))
+	(scroll-up lines))
+    (end-of-buffer
+     ;; Long lines may cause an end-of-buffer error.
+     (goto-char (point-max))))
+  (gnus-article-beginning-of-window))
 
 (defun gnus-article-prev-page (&optional lines)
   "Show previous page of current article.
--- a/lisp/gnus/mm-decode.el	Sat Jul 30 19:04:19 2005 +0000
+++ b/lisp/gnus/mm-decode.el	Sun Jul 31 00:12:23 2005 +0000
@@ -817,11 +817,32 @@
 	    (let ((command (mm-mailcap-command
 			    method file (mm-handle-type handle))))
 	      (unwind-protect
-		  (start-process "*display*"
-				 (setq buffer
-				       (generate-new-buffer " *mm*"))
-				 shell-file-name
-				 shell-command-switch command)
+		  (progn
+		    (start-process "*display*"
+				   (setq buffer
+					 (generate-new-buffer " *mm*"))
+				   shell-file-name
+				   shell-command-switch command)
+		    (set-process-sentinel
+		     (get-buffer-process buffer)
+		     `(lambda (process state)
+			(when (eq 'exit (process-status process))
+			  ;; Don't use `ignore-errors'.
+			  (condition-case nil
+			      (delete-file ,file)
+			    (error))
+			  (condition-case nil
+			      (delete-directory ,(file-name-directory file))
+			    (error))
+			  (condition-case nil
+			      (kill-buffer ,buffer)
+			    (error))
+			  (condition-case nil
+			      ,(macroexpand (list 'mm-handle-set-undisplayer
+						  (list 'quote handle)
+						  nil))
+			    (error))
+			  (message "Displaying %s...done" ,command)))))
 		(mm-handle-set-external-undisplayer
 		 handle (cons file buffer)))
 	      (message "Displaying %s..." command))
--- a/lisp/gnus/mml.el	Sat Jul 30 19:04:19 2005 +0000
+++ b/lisp/gnus/mml.el	Sun Jul 31 00:12:23 2005 +0000
@@ -123,7 +123,13 @@
 with unknown encoding; `multipart': always send messages with more than
 one charsets.")
 
-(defvar mml-generate-default-type "text/plain")
+(defvar mml-generate-default-type "text/plain"
+  "Content type by which the Content-Type header can be omitted.
+The Content-Type header will not be put in the MIME part if the type
+equals the value and there's no parameter (e.g. charset, format, etc.)
+and `mml-insert-mime-headers-always' is nil.  The value will be bound
+to \"message/rfc822\" when encoding an article to be forwarded as a MIME
+part.  This is for the internal use, you should never modify the value.")
 
 (defvar mml-buffer-list nil)
 
@@ -400,9 +406,12 @@
       (mml-tweak-part cont)
       (cond
        ((or (eq (car cont) 'part) (eq (car cont) 'mml))
-	(let ((raw (cdr (assq 'raw cont)))
-	      coded encoding charset filename type flowed)
-	  (setq type (or (cdr (assq 'type cont)) "text/plain"))
+	(let* ((raw (cdr (assq 'raw cont)))
+	       (filename (cdr (assq 'filename cont)))
+	       (type (or (cdr (assq 'type cont))
+			 (and filename (mm-default-file-encoding filename))
+			 "application/octet-stream"))
+	       coded encoding charset flowed)
 	  (if (and (not raw)
 		   (member (car (split-string type "/")) '("text" "message")))
 	      (progn
@@ -414,7 +423,7 @@
 		  (cond
 		   ((cdr (assq 'buffer cont))
 		    (insert-buffer-substring (cdr (assq 'buffer cont))))
-		   ((and (setq filename (cdr (assq 'filename cont)))
+		   ((and filename
 			 (not (equal (cdr (assq 'nofile cont)) "yes")))
 		    (let ((coding-system-for-read charset))
 		      (mm-insert-file-contents filename)))
@@ -434,6 +443,10 @@
 		  (cond
 		   ((eq (car cont) 'mml)
 		    (let ((mml-boundary (mml-compute-boundary cont))
+			  ;; It is necessary for the case where this
+			  ;; function is called recursively since
+			  ;; `m-g-d-t' will be bound to "message/rfc822"
+			  ;; when encoding an article to be forwarded.
 			  (mml-generate-default-type "text/plain"))
 		      (mml-to-mime))
 		    (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
@@ -475,7 +488,7 @@
 		(insert (with-current-buffer (cdr (assq 'buffer cont))
 			  (mm-with-unibyte-current-buffer
 			    (buffer-string)))))
-	       ((and (setq filename (cdr (assq 'filename cont)))
+	       ((and filename
 		     (not (equal (cdr (assq 'nofile cont)) "yes")))
 		(let ((coding-system-for-read mm-binary-coding-system))
 		  (mm-insert-file-contents filename nil nil nil nil t)))
@@ -516,15 +529,19 @@
 	     "access-type=url"))
 	  (when parameters
 	    (mml-insert-parameter-string
-	     cont '(expiration size permission))))
-	(insert "\n\n")
-	(insert "Content-Type: " (cdr (assq 'type cont)) "\n")
-	(insert "Content-ID: " (message-make-message-id) "\n")
-	(insert "Content-Transfer-Encoding: "
-		(or (cdr (assq 'encoding cont)) "binary"))
-	(insert "\n\n")
-	(insert (or (cdr (assq 'contents cont))))
-	(insert "\n"))
+	     cont '(expiration size permission)))
+	  (insert "\n\n")
+	  (insert "Content-Type: "
+		  (or (cdr (assq 'type cont))
+		      (and name (mm-default-file-encoding name))
+		      "application/octet-stream")
+		  "\n")
+	  (insert "Content-ID: " (message-make-message-id) "\n")
+	  (insert "Content-Transfer-Encoding: "
+		  (or (cdr (assq 'encoding cont)) "binary"))
+	  (insert "\n\n")
+	  (insert (or (cdr (assq 'contents cont))))
+	  (insert "\n")))
        ((eq (car cont) 'multipart)
 	(let* ((type (or (cdr (assq 'type cont)) "mixed"))
 	       (mml-generate-default-type (if (equal type "digest")
@@ -560,7 +577,8 @@
 	    (message-options-set 'message-sender sender))
 	  (if (setq recipients (cdr (assq 'recipients cont)))
 	      (message-options-set 'message-recipients recipients))
-	  (let ((style (mml-signencrypt-style (first (or sign-item encrypt-item)))))
+	  (let ((style (mml-signencrypt-style
+			(first (or sign-item encrypt-item)))))
 	    ;; check if: we're both signing & encrypting, both methods
 	    ;; are the same (why would they be different?!), and that
 	    ;; the signencrypt style allows for combined operation.