all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21471@debbugs.gnu.org
Subject: bug#21471: 25.0.50; bug report with text from Info has spurious escape chars
Date: Mon, 14 Sep 2015 14:10:51 -0700	[thread overview]
Message-ID: <55F737DB.5040003@cs.ucla.edu> (raw)
In-Reply-To: <83vbbc982y.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

Eli Zaretskii wrote:
> What was this fix supposed to change?

It was supposed to fix the two scenarios mentioned (one mine, the other Drew's). 
  I didn't know the clipboard didn't work.  Fixed, I hope, with the attached patch.

[-- Attachment #2: 0001-Don-t-double-encode-non-ASCII-mail-clipboard.patch --]
[-- Type: text/plain, Size: 3242 bytes --]

From 59f0b53c1092b1528d34d9c4edebcf034be628a4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 14 Sep 2015 14:09:24 -0700
Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20double-encode=20non-ASCII=20mai?=
 =?UTF-8?q?l=20clipboard?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/mail/mailclient.el (mailclient-send-it):
Also fix the case when mailclient-place-body-on-clipboard-flag
is non-nil.  Problem reported by Eli Zaretskii (Bug#21471#37).
---
 lisp/mail/mailclient.el | 56 ++++++++++++++++++++++---------------------------
 1 file changed, 25 insertions(+), 31 deletions(-)

diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index bef2038..2fb944b 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -175,37 +175,31 @@ The mail client is taken to be the handler of mailto URLs."
 			       (mailclient-encode-string-as-url subj))
 		     ""))))
 	      ;; body
-	      (concat
-	       (mailclient-url-delim) "body="
-	       (mailclient-encode-string-as-url
-		(if mailclient-place-body-on-clipboard-flag
-		    (progn
-		      (clipboard-kill-ring-save
-		       (+ 1 delimline) (point-max))
-		      (concat
-		       "*** E-Mail body has been placed on clipboard, "
-		       "please paste it here! ***"))
-		  ;; else
-		  (let ((body (buffer-substring (+ 1 delimline) (point-max))))
-		    (if (null character-coding)
-			body
-		      ;; mailto: requires UTF-8 and cannot deal with
-		      ;; Content-Transfer-Encoding or Content-Type.
-		      ;; FIXME: There is a lot of code duplication here
-		      ;; with rmail.el.
-		      (erase-buffer)
-		      (set-buffer-multibyte nil)
-		      (insert body)
-		      (cond
-		       ((string= character-coding "quoted-printable")
-			(mail-unquote-printable-region (point-min) (point-max)
-						       nil nil 'unibyte))
-		       ((string= character-coding "base64")
-			(base64-decode-region (point-min) (point-max)))
-		       (t (error "unsupported Content-Transfer-Encoding: %s"
-				 character-coding)))
-		      (decode-coding-region (point-min) (point-max)
-					    coding-system t)))))))))))))
+	      (mailclient-url-delim) "body="
+	      (progn
+		(delete-region (point-min) delimline)
+		(unless (null character-coding)
+		  ;; mailto: and clipboard need UTF-8 and cannot deal with
+		  ;; Content-Transfer-Encoding or Content-Type.
+		  ;; FIXME: There is code duplication here with rmail.el.
+		  (set-buffer-multibyte nil)
+		  (cond
+		   ((string= character-coding "base64")
+		    (base64-decode-region (point-min) (point-max)))
+		   ((string= character-coding "quoted-printable")
+		    (mail-unquote-printable-region (point-min) (point-max)
+						   nil nil t))
+		   (t (error "unsupported Content-Transfer-Encoding: %s"
+			     character-coding)))
+		  (decode-coding-region (point-min) (point-max) coding-system))
+		(mailclient-encode-string-as-url
+		 (if mailclient-place-body-on-clipboard-flag
+		     (progn
+		       (clipboard-kill-ring-save (point-min) (point-max))
+		       (concat
+			"*** E-Mail body has been placed on clipboard, "
+			"please paste it here! ***"))
+		   (buffer-string)))))))))))
 
 (provide 'mailclient)
 
-- 
2.1.4


  reply	other threads:[~2015-09-14 21:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<55F5CBA0.90406@cs.ucla.edu>
     [not found] ` <<065d972a-464a-4d55-9b67-29b3827caeb9@default>
     [not found]   ` <<83si6ha5dd.fsf@gnu.org>
2015-09-14 13:41     ` bug#21471: 25.0.50; bug report with text from Info has spurious escape chars Drew Adams
2015-09-14 16:38       ` Paul Eggert
2015-09-14 18:20         ` Eli Zaretskii
2015-09-14 21:10           ` Paul Eggert [this message]
2015-09-15  6:56             ` Eli Zaretskii
     [not found] <<cde9bbc9-378e-4656-8d10-caf2b8e208b7@default>
     [not found] ` <<83wpvu9jf1.fsf@gnu.org>
2015-09-13 20:58   ` bug#21471: 25.0.50; REGRESSION: " Drew Adams
2015-09-14  6:22     ` Eli Zaretskii
     [not found]   ` <<ad82df82-fa76-4fcf-bd11-0b15de8dcb3a@default>
     [not found]     ` <<83r3m1a5bf.fsf@gnu.org>
2015-09-14 13:47       ` Drew Adams
2015-09-13 15:07 Drew Adams
2015-09-13 19:16 ` bug#21471: 25.0.50; " Paul Eggert
2015-09-13 20:55   ` Drew Adams
2015-09-14  6:21     ` Eli Zaretskii
2015-09-13 20:02 ` bug#21471: 25.0.50; REGRESSION: " Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F737DB.5040003@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=21471@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.