emacs-devel
[Top][All Lists]
Advanced

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

Re: master 8f03888: * lisp/gnus/gnus-art.el: Fix up compiler warnings.


From: Lars Magne Ingebrigtsen
Subject: Re: master 8f03888: * lisp/gnus/gnus-art.el: Fix up compiler warnings.
Date: Fri, 16 Jan 2015 03:22:45 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> The keyword here is "sort of".  And of course, the behavior was
> different in Emacs-22, yet most/all of this code dates back to before
> Emacs-23, so that makes it even more murky.

Indeed.

> Conversions between bytes ("unibyte") and characters ("multibyte")
> should be done by encoding/decoding.  Using terms like "converting from
> unibyte to multibyte" just messes up with your head to make sure you
> can't think straight.

Yes.

Here's the first usage grep shows:

(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)
    (funcall (utf7-get-u16char-converter 'to-utf-16))
    (mm-with-unibyte-current-buffer
      (base64-encode-region start (point-max)))
    (goto-char start)
    (let ((pm (point-max)))
      (when for-imap
        (while (search-forward "/" nil t)
          (replace-match ",")))
      (skip-chars-forward "^= \t\n" pm)
      (delete-region (point) pm))))

So we have some non-ASCII text in the buffer, and er, we convert that to
utf-16?  And then we convert the utf-16 represented as utf-8 byte
sequences to base64?  Uhm.

Yeah, OK, `mm-with-unibyte-current-buffer' is probably not helping with
understanding that function any.  :-)  So if somebody would be so kind
to rewrite these functions, that would be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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