From: teranisi Date: Tue, 31 Aug 2004 05:52:04 +0000 (+0000) Subject: (utf7-fragment-encode): Don't use narrow-to-region to X-Git-Tag: wl-2_11_31~34 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a3d69085be30f08bf55db949762641e8689f3776;p=elisp%2Fwanderlust.git (utf7-fragment-encode): Don't use narrow-to-region to avoid the bug of Emacs 21.3. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 85f98ee..ee38703 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,8 @@ +2004-08-31 Yuuichi Teranishi + + * utf7.el (utf7-fragment-encode): Don't use narrow-to-region to + avoid the bug of Emacs 21.3. + 2004-08-31 Yoichi NAKAYAMA * utf7.el (utf7-utf-16-coding-system): Avoid error when the diff --git a/elmo/utf7.el b/elmo/utf7.el index ae050f9..c6081e8 100644 --- a/elmo/utf7.el +++ b/elmo/utf7.el @@ -67,6 +67,9 @@ ;; * Don't use mm-with-unibyte-current-buffer etc. ;; * Do nothing if utf-16 coding system is not found. +;; Modified 31 Aug 2004 by Yuuichi Teranishi so that it can avoid the bug of +;; Emacs 21.3 release version. + ;;; Code: (eval-when-compile (require 'cl)) @@ -125,21 +128,26 @@ Use IMAP modification if FOR-IMAP is non-nil." (defun utf7-fragment-encode (start end &optional for-imap) "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) - (let ((converter (utf7-get-u16char-converter 'to-utf-16)) - pm) - (when converter - (funcall converter) - (set-buffer-multibyte nil) - (utf7-base64-encode-region start (point-max)) - (goto-char start) - (setq pm (point-max)) - (when for-imap - (while (search-forward "/" nil t) - (replace-match ","))) - (skip-chars-forward "^= \t\n" pm) - (delete-region (point) pm))))) + (let ((converter (utf7-get-u16char-converter 'to-utf-16)) + (str (buffer-substring start end)) + pm) + (when converter + (delete-region start end) + (goto-char start) + (insert + (with-temp-buffer + (insert str) + (funcall converter) + (set-buffer-multibyte nil) + (utf7-base64-encode-region (point-min) (point-max)) + (goto-char (point-min)) + (setq pm (point-max)) + (when for-imap + (while (search-forward "/" nil t) + (replace-match ","))) + (skip-chars-forward "^= \t\n" pm) + (delete-region (point) pm) + (buffer-string)))))) (defun utf7-decode-internal (&optional for-imap) "Decode UTF-7 text in (temporary) buffer.