emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 1efdf7f: Make TAGS files more portable to MS-Window


From: Paul Eggert
Subject: [Emacs-diffs] master 1efdf7f: Make TAGS files more portable to MS-Windows
Date: Mon, 25 May 2015 20:22:40 +0000

branch: master
commit 1efdf7feb3e1a56649ea5da621cdf246d9a4ec50
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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 |   11 +++++++++--
 3 files changed, 12 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..9ff164e 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1355,9 +1355,16 @@ 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)))
+          ;; Act as if CRs were elided from all preceding lines.
+          ;; Although this doesn't always give exactly the correct position,
+          ;; it does typically improve the guess.
+          (setq startpos (- startpos (1- line)))))
       ;; If no char pos was given, try the given line number.
       (or startpos
          (if line



reply via email to

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