From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master c4782ea: Improve and extend filepos-to-bufferpos Date: Fri, 19 Jun 2015 11:20:57 +0300 Message-ID: <83wpz0jehi.fsf@gnu.org> References: <20150618120808.22624.13860@vcs.savannah.gnu.org> <83y4jgji91.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1434702101 22482 80.91.229.3 (19 Jun 2015 08:21:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Jun 2015 08:21:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 19 10:21:29 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z5rYA-0005Lh-5v for ged-emacs-devel@m.gmane.org; Fri, 19 Jun 2015 10:21:22 +0200 Original-Received: from localhost ([::1]:56854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5rY9-0000go-AE for ged-emacs-devel@m.gmane.org; Fri, 19 Jun 2015 04:21:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5rXv-0000gY-GL for emacs-devel@gnu.org; Fri, 19 Jun 2015 04:21:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5rXs-0006xl-NQ for emacs-devel@gnu.org; Fri, 19 Jun 2015 04:21:07 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:50623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5rXs-0006ws-Ef for emacs-devel@gnu.org; Fri, 19 Jun 2015 04:21:04 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NQ600I00MS51C00@mtaout24.012.net.il> for emacs-devel@gnu.org; Fri, 19 Jun 2015 11:12:36 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NQ600I34MT04000@mtaout24.012.net.il>; Fri, 19 Jun 2015 11:12:36 +0300 (IDT) In-reply-to: <83y4jgji91.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.180 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187308 Archived-At: 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 > Cc: emacs-devel@gnu.org > > > > (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. This one. > > > + (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. Thanks.