]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2172: Get line and column numbers right.
authorDavid Kastrup <dak@gnu.org>
Thu, 13 Dec 2012 10:53:02 +0000 (11:53 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 21 Dec 2012 16:37:59 +0000 (17:37 +0100)
This uses 1-based columns on all error output, as is the standard for
GNU programs.  It also flags version errors as being for line 1
instead of line 0 since the latter confuses Emacs' compilation mode.

The same column convention is used for point-and-click column numbers
in textedit:// URIs.  In contrast, the byte offsets into a line (also
in those URIs) are retained 0-based.

For point-and-click, this yields the correct results when using the
definitions for emacs and gvim in scm/editor.scm, the editors
configured to interpret the column number.

It is to be expected that Lilypond-specific shells (like Frescobaldi
called via Okular for point-and-click) have specialized on the
previous wrong behavior and will now exhibit the kind of one-off
behavior that non-LilyPond specific programs did previously when
encountering the error messages.

I don't see a good migration strategy for those except possibly
looking for the version number of LilyPond and deciding whether to do
one-off calculations depending on that.

Documentation/changes.tely
lily/source-file.cc
scm/lily-library.scm
scm/output-ps.scm

index f0d11f45e862e1482715b49798eb459c0485be4f..630dad3bcb315d908977b70d0294a80d99dc60d9 100644 (file)
@@ -61,6 +61,13 @@ which scares away people.
 
 @end ignore
 
+@item
+Starting with version@tie{}2.17.10, error messages or the
+@code{textedit} @acronym{URI} used for point-and-click
+functionality specify column numbers starting with@tie{}1 rather
+than@tie{}0.  The byte offset (also part of @code{textedit}
+@acronym{URI}s) still starts at@tie{}0.
+
 @item
 The @code{\clef} command supports optional octavation:
 @lilypond[verbatim,quote,relative=1]
index d847605425b0d9be7a9ec79bf66f0d2b462a8004..6ecedc9854f1880df2106802053df8dfa0aadb92 100644 (file)
@@ -182,7 +182,7 @@ Source_file::file_line_column_string (char const *context_str0) const
       get_counts (context_str0, &l, &ch, &col, &offset);
 
       return name_string () + ":" + to_string (l)
-             + ":" + to_string (col);
+             + ":" + to_string (col + 1);
     }
 }
 
index d21e292ccf2b7f2ecc97856da3895aa182dd3d8f..da04e6c89662e769015a0f8e2b0b3491d3378de6 100644 (file)
@@ -997,11 +997,11 @@ print a warning and set an optional @var{default}."
 
 (define-public (version-not-seen-message input-file-name)
   (ly:warning-located
-    (ly:format "~a:0" input-file-name)
+    (ly:format "~a:1" input-file-name)
     (_ "no \\version statement found, please add~afor future compatibility")
     (format #f "\n\n\\version ~s\n\n" (lilypond-version))))
 
 (define-public (old-relative-not-used-message input-file-name)
   (ly:warning-located
-    (ly:format "~a:0" input-file-name)
+    (ly:format "~a:1" input-file-name)
     (_ "old relative compatibility not used")))
index 497f197aebd80e4ab8e872bbf976655dbf28ba8d..dd92175feb931066f0583562a45bd6e40746a8e3 100644 (file)
 
                             (cadr location)
                             (caddr location)
-                            (cadddr location))
+                            (1+ (cadddr location)))
                  ""))
            ""))
       ""))