From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: etags test is broken on MS-Windows Date: Mon, 25 May 2015 09:44:00 -0700 Organization: UCLA Computer Science Department Message-ID: <55635150.60208@cs.ucla.edu> References: <83y4kmdjmj.fsf@gnu.org> <831ti957wp.fsf@gnu.org> <83pp5s4uml.fsf@gnu.org> <555F740D.4030304@cs.ucla.edu> <837fs04egz.fsf@gnu.org> <87oalco1mg.fsf@igel.home> <83y4kg2yjc.fsf@gnu.org> <83wq002yct.fsf@gnu.org> <87fv6oo0h3.fsf@igel.home> <83vbfk2x9l.fsf@gnu.org> <87bnhcnym6.fsf@igel.home> <83pp5r3iij.fsf@gnu.org> <838ucf3dh8.fsf@gnu.org> <834mn339p2.fsf@gnu.org> <831ti7389n.fsf@gnu.org> <87oalbsgwl.fsf@igel.home> <83wpzz1qf8.fsf@gnu.org> <87k2vzsde4.fsf@igel.home> <83vbfj1k5c.fsf@gnu.org> <5560CE70.4040407@cs.ucla.edu> <83fv6n14cu.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090800020104060703090500" X-Trace: ger.gmane.org 1432572286 32025 80.91.229.3 (25 May 2015 16:44:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 May 2015 16:44:46 +0000 (UTC) Cc: pot@gnu.org, schwab@linux-m68k.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 25 18:44:37 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 1YwvUS-0003ot-GA for ged-emacs-devel@m.gmane.org; Mon, 25 May 2015 18:44:36 +0200 Original-Received: from localhost ([::1]:44473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwvUR-00064e-NG for ged-emacs-devel@m.gmane.org; Mon, 25 May 2015 12:44:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwvUC-00064M-7U for emacs-devel@gnu.org; Mon, 25 May 2015 12:44:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwvU8-0002Gq-As for emacs-devel@gnu.org; Mon, 25 May 2015 12:44:20 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:50301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwvU1-0002FG-UJ; Mon, 25 May 2015 12:44:10 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 8391039E801B; Mon, 25 May 2015 09:44:01 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kch-al3Ocj7f; Mon, 25 May 2015 09:44:00 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 6153439E8018; Mon, 25 May 2015 09:44:00 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <83fv6n14cu.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 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:186808 Archived-At: This is a multi-part message in MIME format. --------------090800020104060703090500 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Eli Zaretskii wrote: > I already said I didn't mind, although I don't think it's an > improvement. Isn't it an improvement in the sense that it makes TAGS files portable between MS-Windows and other platforms? That is, with the attached patch one can create a TAGS file on GNU/Linux and use it on MS-Windows and vice versa, and it works the same either way. --------------090800020104060703090500 Content-Type: text/x-patch; name="0001-Make-TAGS-files-more-portable-to-MS-Windows.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Make-TAGS-files-more-portable-to-MS-Windows.patch" >From 247e3bf4aa06b5b2dab9f70556292458751f0445 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 May 2015 09:40:45 -0700 Subject: [PATCH] Make TAGS files more portable to MS-Windows * etc/NEWS: Document this. * lib-src/etags.c (readline_internal) [DOS_NT]: Don't treat CRs differently from GNUish hosts. * lisp/progmodes/etags.el (etags-goto-tag-location): Adjust STARTPOS to account for the skipped CRs in dos-style files. --- etc/NEWS | 3 +++ lib-src/etags.c | 9 --------- lisp/progmodes/etags.el | 8 ++++++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index b922a27..9f861b2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -992,6 +992,9 @@ of Windows starting with Windows 9X. +++ ** Emacs running on MS-Windows now supports the daemon mode. +** The byte counts in etags-generated TAGS files are now the same on +MS-Windows as they are on other platforms. + ** OS X 10.5 or older is no longer supported. ** OS X on PowerPC is no longer supported. diff --git a/lib-src/etags.c b/lib-src/etags.c index f124d29..8b7f53c 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6075,16 +6075,7 @@ readline_internal (linebuffer *lbp, FILE *stream, char const *filename) if (p > buffer && p[-1] == '\r') { p -= 1; -#ifdef DOS_NT - /* Assume CRLF->LF translation will be performed by Emacs - when loading this file, so CRs won't appear in the buffer. - It would be cleaner to compensate within Emacs; - however, Emacs does not know how many CRs were deleted - before any given point in the file. */ - chars_deleted = 1; -#else chars_deleted = 2; -#endif } else { diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 60ea456..d99db8b 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1355,9 +1355,13 @@ hits the start of file." pat (concat (if (eq selective-display t) "\\(^\\|\^m\\)" "^") (regexp-quote (car tag-info)))) - ;; The character position in the tags table is 0-origin. + ;; The character position in the tags table is 0-origin and counts CRs. ;; Convert it to a 1-origin Emacs character position. - (if startpos (setq startpos (1+ startpos))) + (when startpos + (setq startpos (1+ startpos)) + (when (and line + (eq 1 (coding-system-eol-type buffer-file-coding-system))) + (setq startpos (- startpos (1- line))))) ;; If no char pos was given, try the given line number. (or startpos (if line -- 2.1.0 --------------090800020104060703090500--