GNU bug report logs -
#79871
Improvement to ispell-add-per-file-word-list
Previous Next
To reply to this bug, email your comments to 79871 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79871; Package
emacs.
(Thu, 20 Nov 2025 16:30:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Thu, 20 Nov 2025 16:30:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I noticed that ispell-add-per-file-word-list did not work properly with
comment syntaxes that have a comment-end and that do not nest, because they
always insert a comment-end for each new line of words, so with XML syntax
you end up with:
<-- LocalWords: foo bar…
<-- LocalWords: baz bunge…
-->
-->
The comment is terminated by the first -->, and this is no longer valid XML.
The same will happen in C.
I attach a patch to fix this. The options are a little involved, so I'll
spell them out.
1. If there's already space in a LocalWords line, there's no
comment-related shenanigans, and we go straight to the last step, 4.
2. Otherwise, we need to insert a new LocalWords line. There are two cases:
a. We already have at least one LocalWords line, and point is directly
after the last one. Insert a newline. If we are using line comments, insert
a comment start.
b. We don't have any LocalWords lines yet. Go to point-max open a line, and
insert a newline. If we are using block comments, put a comment-end at the
end of the buffer. In any case, if we're using comments at all, put a
comment-start at point.
(Note that if we're using block comments, this is the only time we write
comment markers, and we write both a start and an end.)
3. Write the LocalWords keyword.
4. Write the actual word.
The result is that modes that use line comments work exactly as at present,
which modes that use block comments have only one comment for the entire
LocalWords list:
<--
LocalWords: foo bar
LocalWords: baz bunge
-->
This works with "both" types of block comments, i.e. those that nest, and
those that don't, since it only ever writes one set of comments.
I've adjusted the tests that deal with this. There are two, one that
previously passed (ispell/ispell-add-per-file-word-list/nxml), and one that
was an expected fail, which now passes
(ispell/ispell-add-per-file-word-list/longline). The tests both expect the
adjusted format, output, and the second test is no longer expected to fail.
(I've not been contributing to Emacs recently much, but I do have a
copyright assignment on file!)
--
Web: rrt.sc3d.org
[Message part 2 (text/html, inline)]
[0001-Fix-ispell-s-handling-of-comment-end-when-adding-loc.patch (text/x-patch, attachment)]
This bug report was last modified 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.