summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-09-29 17:37:59 +0530
committerArun Isaac2021-09-29 17:37:59 +0530
commit44ab323da4b298e5ae770a1c84921d25049b75da (patch)
tree506b738b6e44938bea18cfe31dab8684b61797d6
parent6c9bd2d179bf50cab020618b1e8cb526cbe8d1ca (diff)
downloadgn-gemtext-44ab323da4b298e5ae770a1c84921d25049b75da.tar.gz
gnbug: Detect bug or critical only as whole words in keywords.
This is to prevent mistaken detection of the keyword "gnbug" as having
"bug" in it.

* gnbug (print-issue): Detect bug or critical only as whole words in
keywords.
-rwxr-xr-xgnbug10
1 files changed, 6 insertions, 4 deletions
diff --git a/gnbug b/gnbug
index eb8bbe5..d353cf0 100755
--- a/gnbug
+++ b/gnbug
@@ -334,15 +334,17 @@ List recent updates.
 (define (print-issue issue-number issue)
   "Print ISSUE with number ISSUE-NUMBER."
   (display (magenta (issue-title issue)))
-  ;; Highlight keywords containing "bug" or "critical" in red. Else,
-  ;; highlight in blue.
+  ;; Highlight keywords containing "bug" or "critical" as whole words
+  ;; in red. Else, highlight in blue.
   (unless (null? (issue-keywords issue))
     (display " ")
     (display (string-join
               (map (lambda (keyword)
                      ((cond
-                       ((any (cut string-contains keyword <>)
-                             (list "bug" "critical"))
+                       ((not (null? (lset-intersection
+                                     string=?
+                                     (string-split keyword #\space)
+                                     (list "bug" "critical"))))
                         red-background)
                        (else blue-background))
                       (string-append " " keyword " ")))