[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master c4782ea: Improve and extend filepos-to-bufferpo
Re: [Emacs-diffs] master c4782ea: Improve and extend filepos-to-bufferpos
Fri, 19 Jun 2015 11:20:57 +0300
I've fixed in commit a2bb6c7 a few of the issues you pointed out:
> Date: Fri, 19 Jun 2015 09:59:38 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> > > (let ((eol (coding-system-eol-type coding-system))
> > > (type (coding-system-type coding-system))
> > > + (base (coding-system-base coding-system))
> > > (pm (save-restriction (widen) (point-min))))
> > > + (and (eq type 'utf-8-emacs)
> > > + (setq type 'utf-8))
> > (coding-system-type 'utf-8-emacs) returns `utf-8', so how/when can
> > `type' be `utf-8-emacs'?
> Never. I guess I got confused with coding-system-base.
> > > + (and (not (eq type 'utf-8))
> > > + (eq quality 'exact)
> > > + (setq type 'use-exact))
> > IIUC this makes us use the slow exact code for latin-N.
> Only if they ask for 'exact'.
> > Why is it needed?
And this one.
> > > + (`utf-16
> > > + ;; Account for BOM, which is always 2 bytes in UTF-16.
> > > + (setq byte (- byte 2))
> > Should that only be done for utf1-16B-with-signature?
> Do we have a UTF-16 encoding without a signature?
And this one. (Yes, we do have such systems, I just missed them when
I reviewed all the definitions.)
> > > + ;; In approximate mode, assume all characters are within the
> > > + ;; BMP, i.e. take up 2 bytes.
> > > + (setq byte (/ byte 2))
> > > + (if (= eol 1)
> > > + (filepos-to-bufferpos--dos (+ pm byte) #'byte-to-position)
> > > + (byte-to-position (+ pm byte))))
> > Shouldn't this use `identity' rather than `byte-to-position'?
> This code tested OK for me, feel free to change if you have a test
> that fails.
And this one; I believe you are right here, and my testing was
probably limited to ASCII-only files.