all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: pot@gnu.org, schwab@linux-m68k.org, emacs-devel@gnu.org
Subject: Re: etags test is broken on MS-Windows
Date: Mon, 25 May 2015 09:44:00 -0700	[thread overview]
Message-ID: <55635150.60208@cs.ucla.edu> (raw)
In-Reply-To: <83fv6n14cu.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

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.

[-- Attachment #2: 0001-Make-TAGS-files-more-portable-to-MS-Windows.patch --]
[-- Type: text/x-patch, Size: 2603 bytes --]

From 247e3bf4aa06b5b2dab9f70556292458751f0445 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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


  reply	other threads:[~2015-05-25 16:44 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83y4kmdjmj.fsf@gnu.org>
     [not found] ` <555A8E62.7060700@cs.ucla.edu>
2015-05-19 15:27   ` etags test is broken on MS-Windows Eli Zaretskii
2015-05-19 17:57     ` Paul Eggert
2015-05-19 18:26       ` Eli Zaretskii
2015-05-20 15:38     ` Eli Zaretskii
2015-05-21  5:05       ` Paul Eggert
2015-05-21 13:24       ` Francesco Potortì
2015-05-21 16:49         ` Eli Zaretskii
2015-05-23  8:46           ` Eli Zaretskii
2015-05-21 13:16     ` Francesco Potortì
2015-05-21 16:31       ` Eli Zaretskii
2015-05-21 16:37         ` Paul Eggert
2015-05-21 16:55           ` Eli Zaretskii
2015-05-21 19:03             ` Paul Eggert
2015-05-21 19:54               ` Eli Zaretskii
2015-05-21 23:28                 ` Paul Eggert
2015-05-22  8:32                   ` Eli Zaretskii
2015-05-22 13:08                     ` Francesco Potortì
2015-05-22 13:19                       ` Eli Zaretskii
2015-05-22 18:23                         ` Paul Eggert
2015-05-22 19:08                           ` Eli Zaretskii
2015-05-22 19:25                             ` Andreas Schwab
2015-05-22 19:38                               ` Eli Zaretskii
2015-05-22 19:41                                 ` Andreas Schwab
2015-05-22 19:42                                 ` Eli Zaretskii
2015-05-22 19:50                                   ` Andreas Schwab
2015-05-22 20:05                                     ` Eli Zaretskii
2015-05-22 20:30                                       ` Andreas Schwab
2015-05-22 21:26                                         ` Paul Eggert
2015-05-23  6:40                                           ` Eli Zaretskii
2015-05-23  6:39                                         ` Eli Zaretskii
2015-05-23  8:02                                           ` Andreas Schwab
2015-05-23  8:27                                             ` Eli Zaretskii
2015-05-23  9:41                                               ` Andreas Schwab
2015-05-23  9:49                                                 ` Eli Zaretskii
2015-05-23  9:59                                                   ` Andreas Schwab
2015-05-23 10:20                                                     ` Eli Zaretskii
2015-05-23 10:54                                                       ` Andreas Schwab
2015-05-23 11:31                                                         ` Eli Zaretskii
2015-05-23 12:10                                                           ` Andreas Schwab
2015-05-23 13:46                                                             ` Eli Zaretskii
2015-05-23 17:27                                                               ` Andreas Schwab
2015-05-23 17:37                                                                 ` Eli Zaretskii
2015-05-23 18:46                                                                   ` Andreas Schwab
2015-05-23 19:04                                                                     ` Eli Zaretskii
2015-05-25 12:33                                                                       ` Francesco Potortì
2015-05-23 19:01                                                               ` Paul Eggert
2015-05-23 19:27                                                                 ` Eli Zaretskii
2015-05-25 16:44                                                                   ` Paul Eggert [this message]
2015-05-25 19:33                                                                     ` Eli Zaretskii
2015-05-25 20:29                                                                       ` Paul Eggert
2015-05-22 12:40               ` Francesco Potortì

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55635150.60208@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=pot@gnu.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.