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

Re: Couple of useful (?) patches



At Tue, 05 Jul 2011 15:32:19 -0400,
Dave Abrahams wrote:
>
> As you can probably guess, I'm +1 for anything that fixes this annoyance.
>

Okay, attached patch should do the trick. It's not optimal because it
depends on the special callback function
`mime-preview-play-current-entity' bound to the text property
`mime-button-callback' to distinguish between a real MIME button and a
browsable URL.

I think SEMI should use a dedicated text-property to indicate that
something is a mime button and not a url.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
diff --git a/wl/wl-draft.el b/wl/wl-draft.el
index 2e3faae..bfcb45e 100644
--- a/wl/wl-draft.el
+++ b/wl/wl-draft.el
@@ -521,8 +521,23 @@ or `wl-draft-reply-with-argument-list' if WITH-ARG argument is non-nil."
 	(when decode-it
 	  (decode-mime-charset-region (point-min) (point-max)
 				      wl-mime-charset))
-	(buffer-substring-no-properties
+	(buffer-substring
 	 (point-min) (point-max)))))
+    (save-excursion
+      (let ((current-prop (eq (get-text-property (point-min) 'mime-button-callback) 'mime-preview-play-current-entity)))
+	(goto-char (point-min))
+	(while (not (eobp))
+	  (let ((next-prop-pos (or (next-single-property-change (point) 'mime-button-callback) (point-max))))
+	    (cond
+	     ((and current-prop (not (get-text-property next-prop-pos 'mime-button-callback)))
+	      (kill-region (point) next-prop-pos)
+	      (setq current-prop nil))
+	     ((and (eq (get-text-property next-prop-pos 'mime-button-callback) 'mime-preview-play-current-entity) (not current-prop))
+	      (goto-char next-prop-pos)
+	      (setq current-prop t))
+	     (t
+	      (goto-char next-prop-pos)))))))
+    (set-text-properties (point-min) (point-max) nil)
     (when ignored-fields
       (goto-char (point-min))
       (wl-draft-delete-fields ignored-fields))

Attachment: pgpHWXjrnUMH7.pgp
Description: PGP signature