emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog mail/rmailmm.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog mail/rmailmm.el
Date: Fri, 25 Sep 2009 06:15:07 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/09/25 06:15:06

Modified files:
        lisp           : ChangeLog 
        lisp/mail      : rmailmm.el 

Log message:
        (rmail-mime-bulk-handler): Print the size of attachments.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16262&r2=1.16263
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmailmm.el?cvsroot=emacs&r1=1.13&r2=1.14

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16262
retrieving revision 1.16263
diff -u -b -r1.16262 -r1.16263
--- ChangeLog   25 Sep 2009 04:46:34 -0000      1.16262
+++ ChangeLog   25 Sep 2009 06:15:01 -0000      1.16263
@@ -30,7 +30,8 @@
        (rmail-mime-insert-image): New function.
        (rmail-mime-image): Use rmail-mime-insert-image.
        (rmail-mime-bulk-handler): Remove optional `image' argument, instead
-       obey the value of `rmail-mime-show-images' option.
+       obey the value of `rmail-mime-show-images' option.  Print the size of
+       attachments.
 
 2009-09-25  David Engster  <address@hidden>
 

Index: mail/rmailmm.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmailmm.el,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mail/rmailmm.el     25 Sep 2009 03:39:07 -0000      1.13
+++ mail/rmailmm.el     25 Sep 2009 06:15:06 -0000      1.14
@@ -177,7 +177,14 @@
                       "noname"))
         (label (format "\nAttached %s file: " (car content-type)))
         (data (buffer-string))
+        (udata (string-as-unibyte data))
+        (size (length udata))
+        (units '(B kB MB GB))
         type)
+    (while (and (> size 1024.0)        ; cribbed from 
gnus-agent-expire-done-message
+               (cdr units))
+      (setq size (/ size 1024.0)
+           units (cdr units)))
     (delete-region (point-min) (point-max))
     (insert label)
     (insert-button filename
@@ -186,23 +193,22 @@
                   'filename filename
                   'directory (file-name-as-directory directory)
                   'data data)
+    (insert (format " (%.0f%s)" size (car units)))
     (when (and rmail-mime-show-images
               (string-match "image/\\(.*\\)" (setq type (car content-type)))
               (setq type (concat "." (match-string 1 type))
                     type (image-type-from-file-name type))
               (memq type image-types)
               (image-type-available-p type))
-      (setq data (string-as-unibyte data))
       (insert " ")
-      ;; FIXME ought to check or at least display the image size.
       (cond ((eq rmail-mime-show-images 'button)
             (insert-button "Display"
                            :type 'rmail-mime-image
                            'help-echo "mouse-2, RET: Show image"
                            'image-type type
-                           'image-data data))
+                           'image-data udata))
            (t
-            (rmail-mime-insert-image type data))))))
+            (rmail-mime-insert-image type udata))))))
 
 (defun test-rmail-mime-bulk-handler ()
   "Test of a mail used as an example in RFC 2183."




reply via email to

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