[gnus git] branch master updated: m0-11-13-gfad73dc =1= gnus-art.el, mm-uu.el: Misc improvements for displaying MIME parts

Katsumi Yamaoka <[email protected]> Wed, 14 May 2014 10:50:46 +0200
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  fad73dc987ae0a339e2c603c25ff33d9c9ade8b6 (commit)
      from  0b06b1140cae4b466e4d0119d2070a628c02aa2b (commit)


- Log -----------------------------------------------------------------
commit fad73dc987ae0a339e2c603c25ff33d9c9ade8b6
Author: Katsumi Yamaoka <[email protected]>
Date:   Wed May 14 08:50:25 2014 +0000

    gnus-art.el, mm-uu.el: Misc improvements for displaying MIME parts
    
    * gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part):
    Work for the last MIME part in an article.
    (gnus-mime-display-single): Suppress excessive newlines between parts.
    
    * mm-uu.el (mm-uu-dissect): Assume that separators may be accompanied
    by leading or trailing newline.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 05be211..f1992be 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2014-05-14  Katsumi Yamaoka  <[email protected]>
+
+	* gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part):
+	Work for the last MIME part in an article.
+	(gnus-mime-display-single): Suppress excessive newlines between parts.
+
+	* mm-uu.el (mm-uu-dissect): Assume that separators may be accompanied
+	by leading or trailing newline.
+
 2014-05-12  Sam Steingold  <[email protected]>
 
 	* time-date.el (seconds-to-string): New function to pretty print time
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 0b6cedf..1949e97 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -5317,7 +5317,8 @@ Compressed files like .gz and .bz2 are decompressed."
       (when (= b (prog1
 		     btn
 		   (setq btn (previous-single-property-change
-			      (next-single-property-change btn 'gnus-data)
+			      (or (next-single-property-change btn 'gnus-data)
+				  (point-max))
 			      'gnus-data))))
 	(setq b btn))
       (if (and (not arg) (mm-handle-undisplayer handle))
@@ -5354,12 +5355,14 @@ Compressed files like .gz and .bz2 are decompressed."
       (if (featurep 'emacs)
 	  (delete-region
 	   (point)
-	   (text-property-any (point) (point-max) 'gnus-data nil))
+	   (or (text-property-any (point) (point-max) 'gnus-data nil)
+	       (point-max)))
 	(let* ((end (text-property-any (point) (point-max) 'gnus-data nil))
 	       (annots (annotations-at end)))
 	  (delete-region (point)
-			 ;; FIXME: why isn't this simply `end'?
-			 (if annots (1+ end) end))
+			 (if end
+			     (if annots (1+ end) end)
+			   (point-max)))
 	  (dolist (annot annots)
 	    (set-extent-endpoints annot (point) (point)))))
       (unless (search-backward "\n\n" nil t)
@@ -5692,7 +5695,8 @@ all parts."
 	      (select-window win)
 	      (goto-char point)))
 	  (setq point (previous-single-property-change
-		       (next-single-property-change point 'gnus-data)
+		       (or (next-single-property-change point 'gnus-data)
+			   (point-max))
 		       'gnus-data))
 	  (if (mm-handle-displayed-p handle)
 	      ;; This will remove the part.
@@ -5729,12 +5733,15 @@ all parts."
       (gnus-insert-mime-button handle id (list (mm-handle-displayed-p handle)))
       (if (featurep 'emacs)
 	  (delete-region
-	   (point) (text-property-any (point) (point-max) 'gnus-data nil))
+	   (point)
+	   (or (text-property-any (point) (point-max) 'gnus-data nil)
+	       (point-max)))
 	(let* ((end (text-property-any (point) (point-max) 'gnus-data nil))
 	       (annots (annotations-at end)))
 	  (delete-region (point)
-			 ;; FIXME: why isn't this simply `end'?
-			 (if annots (1+ end) end))
+			 (if end
+			     (if annots (1+ end) end)
+			   (point-max)))
 	  (dolist (annot annots)
 	    (set-extent-endpoints annot (point) (point)))))
       (unless (search-backward "\n\n" nil t)
@@ -6037,9 +6044,6 @@ If nil, don't show those extra buttons."
 		    (eq id gnus-mime-buttonized-part-id))
 	    (gnus-insert-mime-button
 	     handle id (list (or display (and not-attachment text)))))
-	  (gnus-article-insert-newline)
-	  (when (or display (and text not-attachment))
-	    (forward-line -1))
 	  (setq beg (point))
 	  (cond
 	   (display
@@ -6049,12 +6053,18 @@ If nil, don't show those extra buttons."
 				       (set-buffer gnus-summary-buffer)
 				     (error))
 				   gnus-newsgroup-ignored-charsets)))
-	      (gnus-bind-safe-url-regexp (mm-display-part handle t)))
-	    (goto-char (point-max)))
+	      (gnus-bind-safe-url-regexp (mm-display-part handle t))))
 	   ((and text not-attachment)
+	    (mm-display-inline handle)))
+	  (goto-char (point-max))
+	  (if (string-match "\\`image/" type)
 	      (gnus-article-insert-newline)
-	    (mm-display-inline handle)
-	    (goto-char (point-max))))
+	    (if (prog1
+		    (= (skip-chars-backward "\n") -1)
+		  (forward-char 1))
+		(gnus-article-insert-newline)
+	      (put-text-property (point) (point-max) 'gnus-undeletable t))
+	    (goto-char (point-max)))
 	  ;; Do highlighting.
 	  (save-excursion
 	    (save-restriction
diff --git a/lisp/mm-uu.el b/lisp/mm-uu.el
index 423324a..d91d2a4 100644
--- a/lisp/mm-uu.el
+++ b/lisp/mm-uu.el
@@ -673,7 +673,15 @@ value of `mm-uu-text-plain-type'."
 		     (goto-char text-start)
 		     (re-search-forward "." start-point t)))
 	      (push
-	       (mm-make-handle (mm-uu-copy-to-buffer text-start start-point)
+	       (mm-make-handle
+		(mm-uu-copy-to-buffer
+		 text-start
+		 ;; A start-separator is likely accompanied by
+		 ;; a leading newline.
+		 (if (and (eq (char-before start-point) ?\n)
+			  (eq (char-before (1- start-point)) ?\n))
+		     (1- start-point)
+		   start-point))
 		mm-uu-text-plain-type)
 	       result))
 	  (push
@@ -681,12 +689,16 @@ value of `mm-uu-text-plain-type'."
 	   result)
 	  (goto-char (setq text-start end-point))))
       (when result
-	(if (and (> (point-max) (1+ text-start))
-		 (save-excursion
 	(goto-char text-start)
-		   (re-search-forward "." nil t)))
-	    (push
-	     (mm-make-handle (mm-uu-copy-to-buffer text-start (point-max))
+	(when (re-search-forward "." nil t)
+	  (push (mm-make-handle
+		 (mm-uu-copy-to-buffer
+		  ;; An end-separator is likely accompanied by
+		  ;; a trailing newline.
+		  (if (eq (char-after text-start) ?\n)
+		      (1+ text-start)
+		    text-start)
+		  (point-max))
 		 mm-uu-text-plain-type)
 		result))
 	(setq result (cons "multipart/mixed" (nreverse result))))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |    9 +++++++++
 lisp/gnus-art.el |   42 ++++++++++++++++++++++++++----------------
 lisp/mm-uu.el    |   32 ++++++++++++++++++++++----------
 3 files changed, 57 insertions(+), 26 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project