问题
The D language compiler DMD outputs its coverage analysis in a file containing the original source as
| inout(Ix)[] prefix() inout
| {
2037| assert(!keys.empty);
2037| final switch (keys.length)
| {
000000000| case 1:
000000000| return keys.at!0[];
2037| case 2:
| import std.algorithm.searching : commonPrefix;
2037| return commonPrefix(keys.at!0[], keys.at!1[]);
| }
| }
that is, the original source where each line has been prefixed by a 10-character column containing the execution count (if relevant).
When opened in Emacs I would like this file to be presented as a read-only version of the original source buffer with an green overlay for the lines exercised at least once and with red overlay for the lines never exercised.
How is this most conveniently implemented in Emacs-Lisp? For instance is there a way to efficiently hide the first 10 characters of each line in a buffer?
See also: https://github.com/flycheck/flycheck/issues/1074
来源:https://stackoverflow.com/questions/39418669/showing-d-coverage-results-as-overlays-in-source-buffer