[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #55109] [PATCH] s.tmac: Add the name of the calling macro to a diag
From: |
G. Branden Robinson |
Subject: |
[bug #55109] [PATCH] s.tmac: Add the name of the calling macro to a diagnostic |
Date: |
Sat, 17 Oct 2020 18:48:43 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Update of bug #55109 (project groff):
Severity: 3 - Normal => 1 - Wish
Status: None => Wont Fix
Assigned to: None => gbranden
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
I think this patch has its heart in the right place but doesn't do quite the
right thing.
See bug #59290 for a more philosophical discussion of what I think we want
instead.
I'm attaching my proposed alternative, which is lower-impact in terms of line
count and the spread of impact through the file.
Here's an example of the output it produces.
$ printf '.TL\n' | ./build/test-groff -Tutf8 -z -ms
s.tmac: error: diversion open while ejecting page (last file seen: <standard
input>) (recovering)
$ printf '.TL\n' > /tmp/empty-title.ms && ./build/test-groff -Tutf8 -z -ms
/tmp/empty-title.ms
s.tmac: error: diversion open while ejecting page (last file seen:
/tmp/empty-title.ms) (recovering)
$ printf '.DS\n.DS\n.DE\n' > /tmp/unbalanced-diversion.ms &&
./build/test-groff -Tutf8 -z -ms /tmp/unbalanced-diversion.ms
s.tmac: error: diversion open while ejecting page (last file seen:
/tmp/unbalanced-diversion.ms) (recovering)
$ cat /tmp/two-TL.ms
.TL
This Is My Title
.TL
There Are Many Like It
.PP
But this one is mine.
$ ./build/test-groff -Tutf8 -z -ms /tmp/two-TL.ms
s.tmac:/tmp/two-TL.ms:3: error: TL is not allowed more than once
We can see particularly from the final example above that the name of the
macro emitting the diagnostic is not what is of crucial importance; a
diagnostic message that accurately identifies the problem, accompanied by the
file name and location within, is what will help the user to remedy the
problem.
As it happens, the GNU Coding Standards has excellent advice in this domain.
https://www.gnu.org/prep/standards/html_node/Errors.html
Linus Torvalds once said that the foregoing document should be set on fire and
the ashes urinated upon, a comment oft repeated by his many fans. I am sure
the quality of the diagnostic messages those fans write speaks for itself. Or
would, if such messages existed at all. But in their ethos, Ken Thompson's
infamous '?' (from AT&T "ed") is one character of user communication too
many.
Per code review on the submitted patch, I regard the many scattered identical
changes of "@error:" to "@error: \\$0" and similar to be a code smell. If
that's really what you wanted, the better thing to do would, I suspect, be to
interpolate @error as a string, which would preserve $0 and then @error could
interpolate that itself. See the "Strings" node in the groff Texinfo manual.
"Interpolating a string does not hide existing macro arguments."
Closing as "won't fix", but not because the patch wasn't well-intentioned.
(file #50005)
_______________________________________________________
Additional Item Attachment:
File name: s.tmac.55109.diff Size:1 KB
<https://file.savannah.gnu.org/file/s.tmac.55109.diff?file_id=50005>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55109>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #55109] [PATCH] s.tmac: Add the name of the calling macro to a diagnostic,
G. Branden Robinson <=