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

Couple of useful (?) patches



Hi!

This is follow up to recent issues claimed by Dave Abrahams on wl-en
list. Indeed, I agree with him, here're fixes:

First issue is weird MIME buttons appear in quoted reply. I see no
reason to keep text representation of buttons in reply, do you? To
work that around I propose to turn on visibility of buttons using
relatively recent mime-view-buttons-visible patch (was it a year ago?
or two?) just before reply is going to be rendered. Solution is pretty
dumb: the whole pre-rendered cache is ripping out now, but... It
works, and who cares about cache? ;)

Index: wl-summary.el
===================================================================
RCS file: /cvs/root/wanderlust/wl/wl-summary.el,v
retrieving revision 1.450
diff -p -u -w -r1.450 wl-summary.el
--- wl-summary.el	18 Oct 2010 07:43:32 -0000	1.450
+++ wl-summary.el	6 Apr 2011 02:06:43 -0000
@@ -4031,6 +4031,9 @@ Return t if message exists."
 
 (defun wl-summary-reply-with-citation (&optional arg)
   (interactive "P")
+  (let (mime-view-buttons-visible)
+    (wl-message-buffer-cache-clean-up)
+    (wl-summary-redisplay))
   (when (wl-summary-reply arg t)
     (goto-char (point-max))
     (wl-draft-yank-original)

Next patch is for SEMI. The reason why mime-view-buttons-visible
defcustom has appeared is that people don't want to see MIME buttons
for multipart messages. The only need for them is to see
attachments. So last time I added defcustom and some code around to
toggle visibility of buttons, and now it's a time to finish it
logically. This patch allows to display buttons only for parts in
which we are interested.

Now it is part of type "application", but it can be extended. I've
seen, of course, function mime-view-entity-button-visible-p, which is
commented out, but I was afraid to reanimate this 10-years old code,
because I don't understand it. My approach is less smart may be, but
it works ;)

Please, test these patches. If you'll not find any problems, I'm about
to commit them.

Index: mime-view.el
===================================================================
RCS file: /cvs/root/semi/mime-view.el,v
retrieving revision 1.151.2.28
diff -p -u -w -r1.151.2.28 mime-view.el
--- mime-view.el	24 Oct 2010 10:39:22 -0000	1.151.2.28
+++ mime-view.el	6 Apr 2011 01:49:42 -0000
@@ -82,6 +82,11 @@ buttom. Nil means don't scroll at all."
   :group 'mime-view
   :type 'boolean)
 
+(defcustom mime-view-content-types-to-show '(application)
+  "Content types which have MIME buttons rendered."
+  :group 'mime-view
+  :type '(repeat sexp))
+
 ;;; @ in raw-buffer (representation space)
 ;;;
 
@@ -1095,11 +1100,14 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYP
     (or situation
 	(setq situation
 	      (mime-find-entity-preview-situation entity default-situation)))
-    (let ((button-is-invisible
-	   (or (not mime-view-buttons-visible)
-	       (eq (cdr (or (assq '*entity-button situation)
-			    (assq 'entity-button situation)))
-		   'invisible)))
+    (let* ((entity-button (cdr (or (assq '*entity-button situation)
+                                   (assq 'entity-button situation))))
+           (button-is-visible
+            (and mime-view-buttons-visible
+                 (or (and entity-button
+                          (not (eq entity-button 'invisible)))
+                     (member (cdr (assq 'type (mime-entity-content-type entity)))
+                             mime-view-content-types-to-show))))
 	  (header-is-visible
 	   (eq (cdr (or (assq '*header situation)
 			(assq 'header situation)))
@@ -1112,11 +1120,8 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYP
       (set-buffer preview-buffer)
       (setq nb (point))
       (narrow-to-region nb nb)
-      (or button-is-invisible
-          ;; (if (mime-view-entity-button-visible-p entity)
-	  (mime-view-insert-entity-button entity)
-          ;;   )
-	  )
+      (when button-is-visible
+	  (mime-view-insert-entity-button entity))
       (if header-is-visible
 	  (let ((header-presentation-method
 		 (or (cdr (assq 'header-presentation-method situation))

-- 
wbr, Vitaly