emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 4a3ea23 1/7: Don't use mm-with-unibyte-buffer in ut


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 4a3ea23 1/7: Don't use mm-with-unibyte-buffer in utf7
Date: Fri, 12 Feb 2016 05:15:12 +0000

branch: master
commit 4a3ea2323bb6eebb425c22f0a5de2c544cc1999b
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Don't use mm-with-unibyte-buffer in utf7
    
    * lisp/gnus/utf7.el (utf7-fragment-encode): Don't use
    mm-with-unibyte-buffer.
---
 lisp/gnus/utf7.el |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/gnus/utf7.el b/lisp/gnus/utf7.el
index 2168b7c..bd04eba 100644
--- a/lisp/gnus/utf7.el
+++ b/lisp/gnus/utf7.el
@@ -119,11 +119,17 @@ Use IMAP modification if FOR-IMAP is non-nil."
   "Encode text from START to END in buffer as UTF-7 escape fragment.
 Use IMAP modification if FOR-IMAP is non-nil."
   (save-restriction
-    (narrow-to-region start end)
-    (funcall (utf7-get-u16char-converter 'to-utf-16))
-    (mm-with-unibyte-current-buffer
-      (base64-encode-region start (point-max)))
-    (goto-char start)
+    (let* ((buf (current-buffer))
+          (base (with-temp-buffer
+                  (set-buffer-multibyte nil)
+                  (insert-buffer-substring buf start end)
+                  (funcall (utf7-get-u16char-converter 'to-utf-16))
+                  (base64-encode-region (point-min) (point-max))
+                  (buffer-string))))
+      (narrow-to-region start end)
+      (delete-region (point-min) (point-max))
+      (insert base))
+    (goto-char (point-min))
     (let ((pm (point-max)))
       (when for-imap
        (while (search-forward "/" nil t)
@@ -186,7 +192,6 @@ Use IMAP modification if FOR-IMAP is non-nil."
   "Convert latin 1 (ISO-8859.1) characters to 16 bit Unicode.
 Characters are converted to raw byte pairs in narrowed buffer."
   (encode-coding-region (point-min) (point-max) 'iso-8859-1)
-  (mm-disable-multibyte)
   (goto-char (point-min))
   (while (not (eobp))
     (insert 0)



reply via email to

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