Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
2025-04-26 Mats Lidell <matsl@gnu.org>

* hywiki.el (hywiki-word-face-at-p): Add optional pos to enable reuse.

* test/hy-test-helpers.el (hy-test-word-face-at-region): Simplify by
reusing hywiki-word-face-at-p.

* test/hywiki-tests.el
(hywiki-tests--wikiword-step-check-verification-with-faces): Add
missing WikiWord, Hiho, required by the test. Enable the test for CI.

* test/hywiki-tests.el:
* test/hui-tests.el:
* test/hmouse-info-tests.el:
Expand Down
8 changes: 5 additions & 3 deletions hywiki.el
Original file line number Diff line number Diff line change
Expand Up @@ -3173,9 +3173,11 @@ a HyWikiWord at point."
(= (matching-paren (char-before (nth 1 range)))
(char-after (nth 2 range))))))))

(defun hywiki-word-face-at-p ()
"Non-nil if but at point has `hywiki-word-face' property."
(hproperty:but-get (point) 'face hywiki-word-face))
(defun hywiki-word-face-at-p (&optional pos)
"Non-nil if but at point or optional POS has `hywiki-word-face' property."
(unless pos
(setq pos (point)))
(hproperty:but-get pos 'face hywiki-word-face))

;;;###autoload
(defun hywiki-word-consult-grep (word)
Expand Down
10 changes: 1 addition & 9 deletions test/hy-test-helpers.el
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,12 @@ and the default WORD-LENGTH is 4."
(defvar hy-test-run-failing-flag nil
"Non-nil means test cases that are known to fail will be tried.")

(defun hy-test-word-face-at-point (&optional pos)
"Non-nil if `hywiki--word-face' at POS."
(unless pos
(setq pos (point)))
(cl-dolist (ol (overlays-at pos) nil)
(if (equal (overlay-get ol 'face) 'hywiki--word-face)
(cl-return t))))

(defun hy-test-word-face-at-region (beg end)
"Non-nil if all chars in region [BEG, END] have `hywiki--word-face'."
(interactive "r")
(let (no-face)
(while (and (< beg end) (not no-face))
(unless (hy-test-word-face-at-point beg)
(unless (hywiki-word-face-at-p beg)
(setq no-face t))
(setq beg (1+ beg)))
(not no-face)))
Expand Down
5 changes: 3 additions & 2 deletions test/hywiki-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -1386,13 +1386,14 @@ resulting state at point is a WikiWord or not."
"Run the step check to verify WikiWord is identified under change.
Performs each operation from the step check and verifies if the
resulting state at point is a WikiWord or not."
(skip-unless hy-test-run-failing-flag)
(skip-unless (not noninteractive))
(hywiki-tests--preserve-hywiki-mode
(let* ((hywiki-directory (make-temp-file "hywiki" t))
(wikiHiHo (cdr (hywiki-add-page "HiHo")))
(wikiHiho (cdr (hywiki-add-page "Hiho")))
(wikiHi (cdr (hywiki-add-page "Hi")))
(wikiHo (cdr (hywiki-add-page "Ho")))
(wiki-page-list (list wikiHiHo wikiHi wikiHo))
(wiki-page-list (list wikiHiHo wikiHiho wikiHi wikiHo))
(hywiki-tests--with-face-test t))
(unwind-protect
(progn
Expand Down