emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117102: gnus-art.el, mm-uu.el: Misc improvements fo


From: Katsumi Yamaoka
Subject: [Emacs-diffs] trunk r117102: gnus-art.el, mm-uu.el: Misc improvements for displaying MIME parts
Date: Wed, 14 May 2014 08:50:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117102
revision-id: address@hidden
parent: address@hidden
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Wed 2014-05-14 08:50:51 +0000
message:
  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.
modified:
  lisp/gnus/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-1433
  lisp/gnus/gnus-art.el          gnusart.el-20091113204419-o5vbwnq5f7feedwu-1108
  lisp/gnus/mm-uu.el             mmuu.el-20091113204419-o5vbwnq5f7feedwu-1975
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2014-05-12 06:59:30 +0000
+++ b/lisp/gnus/ChangeLog       2014-05-14 08:50:51 +0000
@@ -1,3 +1,12 @@
+2014-05-14  Katsumi Yamaoka  <address@hidden>
+
+       * 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-09  Katsumi Yamaoka  <address@hidden>
 
        * gnus-art.el (gnus-mm-display-part): Don't put article out of sight

=== modified file 'lisp/gnus/gnus-art.el'
--- a/lisp/gnus/gnus-art.el     2014-05-09 09:50:14 +0000
+++ b/lisp/gnus/gnus-art.el     2014-05-14 08:50:51 +0000
@@ -5316,7 +5316,8 @@
       (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))
@@ -5353,12 +5354,14 @@
       (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)
@@ -5691,7 +5694,8 @@
              (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.
@@ -5728,12 +5732,15 @@
       (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)
@@ -6036,9 +6043,6 @@
                    (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
@@ -6048,12 +6052,18 @@
                                       (set-buffer gnus-summary-buffer)
                                     (error))
                                   gnus-newsgroup-ignored-charsets)))
-             (gnus-bind-safe-url-regexp (mm-display-part handle t)))
+             (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)
+           (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)))
-          ((and text not-attachment)
-           (gnus-article-insert-newline)
-           (mm-display-inline handle)
-           (goto-char (point-max))))
          ;; Do highlighting.
          (save-excursion
            (save-restriction

=== modified file 'lisp/gnus/mm-uu.el'
--- a/lisp/gnus/mm-uu.el        2014-01-01 07:43:34 +0000
+++ b/lisp/gnus/mm-uu.el        2014-05-14 08:50:51 +0000
@@ -673,22 +673,34 @@
                     (goto-char text-start)
                     (re-search-forward "." start-point t)))
              (push
-              (mm-make-handle (mm-uu-copy-to-buffer text-start start-point)
-                              mm-uu-text-plain-type)
+              (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
           (funcall (mm-uu-function-extract entry))
           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))
-                            mm-uu-text-plain-type)
-            result))
+       (goto-char text-start)
+       (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))))
       result)))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]