unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Mysterious use of string-as-multibyte
@ 2018-01-11 16:04 Stefan Monnier
  2018-01-15 14:36 ` handa
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-01-11 16:04 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

Hi,

Do you remember why you added the call to string-as-multibyte in the
patch below?


        Stefan


commit 83af570eae8668c9308050c1bb56b7bd10c0e4e7
Author: Kenichi Handa <handa@m17n.org>
Date:   Tue May 25 11:12:17 1999 +0000

    (smtpmail-send-it): Bind smtpmail-code-conv-from properly.
    (smtpmail-send-data-1): If DATA is a multibyte string, encode it
    by smtpmail-code-conv-from.

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 4778ded17b..192235a242 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -122,7 +122,11 @@ smtpmail-send-it
        (tembuf (generate-new-buffer " smtpmail temp"))
        (case-fold-search nil)
        delimline
-       (mailbuf (current-buffer)))
+       (mailbuf (current-buffer))
+       (smtpmail-code-conv-from
+        (if enable-multibyte-characters
+            (let ((sendmail-coding-system smtpmail-code-conv-from))
+              (select-message-coding-system)))))
     (unwind-protect
        (save-excursion
          (set-buffer tembuf)
@@ -564,8 +568,10 @@ smtpmail-send-command
 (defun smtpmail-send-data-1 (process data)
   (goto-char (point-max))
 
-  (when smtpmail-code-conv-from
-    (setq data (encode-coding-string data *internal* smtpmail-code-conv-from)))
+  (if (and (multibyte-string-p data)
+           smtpmail-code-conv-from)
+      (setq data (string-as-multibyte
+                  (encode-coding-string data smtpmail-code-conv-from))))
        
   (if smtpmail-debug-info
       (insert data "\r\n"))



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Mysterious use of string-as-multibyte
  2018-01-11 16:04 Mysterious use of string-as-multibyte Stefan Monnier
@ 2018-01-15 14:36 ` handa
  2018-01-15 21:39   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: handa @ 2018-01-15 14:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: handa, emacs-devel

In article <jwv373c5qqh.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> Do you remember why you added the call to string-as-multibyte in the
> patch below?
[...]
> -  (when smtpmail-code-conv-from
> -    (setq data (encode-coding-string data *internal* smtpmail-code-conv-from)))
> +  (if (and (multibyte-string-p data)
> +           smtpmail-code-conv-from)
> +      (setq data (string-as-multibyte
> +                  (encode-coding-string data smtpmail-code-conv-from))))
        
>    (if smtpmail-debug-info
>        (insert data "\r\n"))

I don't remember, sorry.  By guessing from the code, that change is to
make DATA a multibyte string so that the encoding done by the following
process-send-string produces the correct byte sequence.  Perhaps, the
change was done before the introduction of string-to-multibyte which is
more suitable for that purpose.

---
K. Handa
handa@gnu.org



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mysterious use of string-as-multibyte
  2018-01-15 14:36 ` handa
@ 2018-01-15 21:39   ` Stefan Monnier
  2018-01-17 12:32     ` handa
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-01-15 21:39 UTC (permalink / raw)
  To: handa; +Cc: emacs-devel

> I don't remember, sorry.  By guessing from the code, that change is to
> make DATA a multibyte string so that the encoding done by the following
> process-send-string produces the correct byte sequence.  Perhaps, the
> change was done before the introduction of string-to-multibyte which is
> more suitable for that purpose.

Thanks.  After verification, process-send-string will nowadays handle
both kinds of strings in the same way, so I dropped the
string-as-multibyte.

        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mysterious use of string-as-multibyte
  2018-01-15 21:39   ` Stefan Monnier
@ 2018-01-17 12:32     ` handa
  0 siblings, 0 replies; 4+ messages in thread
From: handa @ 2018-01-17 12:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

In article <jwv8tcykdjw.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> > I don't remember, sorry.  By guessing from the code, that change is to
> > make DATA a multibyte string so that the encoding done by the following
> > process-send-string produces the correct byte sequence.  Perhaps, the
> > change was done before the introduction of string-to-multibyte which is
> > more suitable for that purpose.

> Thanks.  After verification, process-send-string will nowadays handle
> both kinds of strings in the same way,

Ah, that's good.

> so I dropped the string-as-multibyte.

Thank you.

---
K. Handa
handa@gnu.org



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-17 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 16:04 Mysterious use of string-as-multibyte Stefan Monnier
2018-01-15 14:36 ` handa
2018-01-15 21:39   ` Stefan Monnier
2018-01-17 12:32     ` handa

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).