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: Sat, 26 Sep 2009 19:20:52 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/09/26 19:20:51

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

Log message:
        (rmail-mime-show-images, rmail-mime-bulk-handler):
        Add option to only show images below a certain size.
        (rmail-mime-multipart-handler): Remove unnecessary save-match-data and
        save-excursion calls.

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

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16268
retrieving revision 1.16269
diff -u -b -r1.16268 -r1.16269
--- ChangeLog   26 Sep 2009 09:41:02 -0000      1.16268
+++ ChangeLog   26 Sep 2009 19:20:48 -0000      1.16269
@@ -1,3 +1,10 @@
+2009-09-26  Glenn Morris  <address@hidden>
+
+       * mail/rmailmm.el (rmail-mime-show-images, rmail-mime-bulk-handler):
+       Add option to only show images below a certain size.
+       (rmail-mime-multipart-handler): Remove unnecessary save-match-data and
+       save-excursion calls.
+
 2009-09-26  Eli Zaretskii  <address@hidden>
 
        * makefile.w32-in (WINS_ALMOST): Add cedet (with its

Index: mail/rmailmm.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmailmm.el,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- mail/rmailmm.el     25 Sep 2009 06:15:06 -0000      1.14
+++ mail/rmailmm.el     26 Sep 2009 19:20:51 -0000      1.15
@@ -31,6 +31,7 @@
 ;; Todo:
 
 ;; Handle multipart/alternative.
+;; Offer the option to call external/internal viewers (doc-view, xpdf, etc).
 
 ;;; Code:
 
@@ -48,8 +49,6 @@
   '(("multipart/.*" rmail-mime-multipart-handler)
     ("text/.*" rmail-mime-text-handler)
     ("text/\\(x-\\)?patch" rmail-mime-bulk-handler)
-    ;; FIXME this handler not defined anywhere?
-;;;   ("application/pgp-signature" 
rmail-mime-application/pgp-signature-handler)
     ("\\(image\\|audio\\|video\\|application\\)/.*" rmail-mime-bulk-handler))
   "Functions to handle various content types.
 This is an alist with elements of the form (REGEXP FUNCTION ...).
@@ -78,10 +77,13 @@
 (defcustom rmail-mime-show-images 'button
   "What to do with image attachments that Emacs is capable of displaying.
 If nil, do nothing special.  If `button', add an extra button
-that when pushed displays the image in the buffer.  Anything else
-means to automatically display the image in the buffer."
+that when pushed displays the image in the buffer.  If a number,
+automatically show images if they are smaller than that size (in
+bytes), otherwise add a display button.  Anything else means to
+automatically display the image in the buffer."
   :type '(choice (const :tag "Add button to view image" button)
                 (const :tag "No special treatment" nil)
+                (number :tag "Show if smaller than certain size")
                 (other :tag "Always show" show))
   :version "23.2"
   :group 'rmail-mime)
@@ -179,6 +181,7 @@
         (data (buffer-string))
         (udata (string-as-unibyte data))
         (size (length udata))
+        (osize size)
         (units '(B kB MB GB))
         type)
     (while (and (> size 1024.0)        ; cribbed from 
gnus-agent-expire-done-message
@@ -201,7 +204,9 @@
               (memq type image-types)
               (image-type-available-p type))
       (insert " ")
-      (cond ((eq rmail-mime-show-images 'button)
+      (cond ((or (eq rmail-mime-show-images 'button)
+                (and (numberp rmail-mime-show-images)
+                     (>= osize rmail-mime-show-images)))
             (insert-button "Display"
                            :type 'rmail-mime-image
                            'help-echo "mouse-2, RET: Show image"
@@ -277,13 +282,11 @@
              content-transfer-encoding)))
       (delete-region end next)
       ;; Handle the part.
-      (save-match-data
-       (save-excursion
          (save-restriction
            (narrow-to-region beg end)
-           (rmail-mime-show))))
-      (setq beg next)
-      (goto-char beg))))
+       (rmail-mime-show))
+      (goto-char (setq beg next)))))
+
 
 (defun test-rmail-mime-multipart-handler ()
   "Test of a mail used as an example in RFC 2046."




reply via email to

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