aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorReuben Thomas2025-11-20 14:38:18 +0000
committerEli Zaretskii2025-11-22 13:15:45 +0200
commite1f851e8402167f28c8985b87a60fbf192f8ee98 (patch)
tree2cc6c25e4c57adeb268b709b455120f99d48d777 /test
parent0762d9b4de5a85863f6a54bde9fa504c2b92a9af (diff)
downloademacs-e1f851e8402167f28c8985b87a60fbf192f8ee98.tar.gz
emacs-e1f851e8402167f28c8985b87a60fbf192f8ee98.zip
Fix ispell’s handling of comment-end when adding local words
* lisp/textmodes/ispell.el (ispell-add-per-file-word-list): Deal with `comment-end' in a way that works for comments that don’t nest. We proceed as follows: when `comment-end' is non-empty, we only ever insert one start and one end comment, the first time we add a local word. This works with both C-style (which don’t nest) and Rust-style comments (which do). If we’re using line comments (i.e. comments that only have a `comment-start'), then continue to insert one on each line. * test/lisp/textmodes/ispell-tests/ispell-tests.el (ispell/ispell-add-per-file-word-list/nxml): Adjust test. Bug#79871
Diffstat (limited to 'test')
-rw-r--r--test/lisp/textmodes/ispell-tests/ispell-tests.el10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/lisp/textmodes/ispell-tests/ispell-tests.el b/test/lisp/textmodes/ispell-tests/ispell-tests.el
index b43d32ae95d..8f733d05d2c 100644
--- a/test/lisp/textmodes/ispell-tests/ispell-tests.el
+++ b/test/lisp/textmodes/ispell-tests/ispell-tests.el
@@ -393,7 +393,8 @@ xml comment syntax, which has an opening and a closing marker."
393 (ispell-add-per-file-word-list testword) 393 (ispell-add-per-file-word-list testword)
394 (should (equal (buffer-string) 394 (should (equal (buffer-string)
395 (concat " 395 (concat "
396<!-- " ispell-words-keyword " " testword " 396<!--
397" ispell-words-keyword " " testword "
397--> 398-->
398")))))) 399"))))))
399 400
@@ -421,7 +422,6 @@ Uses default
421xml comment syntax, which has an opening and a closing marker. 422xml comment syntax, which has an opening and a closing marker.
422This test fails, because ispell.el does not work well with 423This test fails, because ispell.el does not work well with
423nXML comments." 424nXML comments."
424 :expected-result :failed
425 (ispell-tests--letopt ((ispell-program-name "ispell")) 425 (ispell-tests--letopt ((ispell-program-name "ispell"))
426 (with-temp-buffer 426 (with-temp-buffer
427 (let* ((testword (format "%s" (random))) 427 (let* ((testword (format "%s" (random)))
@@ -434,11 +434,9 @@ nXML comments."
434 (ispell-add-per-file-word-list testword) 434 (ispell-add-per-file-word-list testword)
435 (should (equal (buffer-string) 435 (should (equal (buffer-string)
436 (concat " 436 (concat "
437<!-- " ispell-words-keyword (make-string fill-column ?a) " 437<!-- " ispell-words-keyword (make-string fill-column ?a)
438-->
439"
440" 438"
441<!-- " ispell-words-keyword " " testword " 439" ispell-words-keyword " " testword "
442--> 440-->
443"))))))) 441")))))))
444 442