Reviewers: Graham Percival,
Message:
On 2012/12/16 01:08:31, Graham Percival wrote:
could we get something in Changes.tely about this? No need to update
this
patch; you can push the modification to changse.tely immediately once
this patch
is accepted.
I did not do so on the theory that "bug fixes should not be mentioned in
Changes", but of course if potentially everybody using the functionality
needs to adapt to the fixed behavior, this is worth mentioning. Will
do. I am also not sure that fixing the (utf-8 character count based)
column number in textedit URIs to 1-based but leaving the byte offset
0-based is the right choice, but I don't know which tools and editors
actually use the byte offset.
Description:
Issue 2172: Get line and column numbers right.
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.
The result works fabulous when using Emacs as text editor. It is to
be expected that Lilypond-specific shells 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.
Please review this at https://codereview.appspot.com/6938044/
Affected files:
M lily/source-file.cc
M scm/lily-library.scm
M scm/output-ps.scm
Index: lily/source-file.cc
diff --git a/lily/source-file.cc b/lily/source-file.cc
index
d847605425b0d9be7a9ec79bf66f0d2b462a8004..6ecedc9854f1880df2106802053df8dfa0aadb92
100644
--- a/lily/source-file.cc
+++ b/lily/source-file.cc
@@ -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: scm/lily-library.scm
diff --git a/scm/lily-library.scm b/scm/lily-library.scm
index
d21e292ccf2b7f2ecc97856da3895aa182dd3d8f..da04e6c89662e769015a0f8e2b0b3491d3378de6
100644
--- a/scm/lily-library.scm
+++ b/scm/lily-library.scm
@@ -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: scm/output-ps.scm
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index
497f197aebd80e4ab8e872bbf976655dbf28ba8d..dd92175feb931066f0583562a45bd6e40746a8e3
100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -177,7 +177,7 @@
(cadr location)
(caddr location)
- (cadddr location))
+ (1+ (cadddr location)))
""))
""))
""))
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel