summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--piem-lei.el14
-rw-r--r--tests/piem-lei-tests.el6
2 files changed, 17 insertions, 3 deletions
diff --git a/piem-lei.el b/piem-lei.el
index f7ccc6e..3760176 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -345,8 +345,18 @@ Return a list with a `piem-lei-msg' object for each root."
(rx string-start
;; Prefix.
(group (zero-or-more space)
- (one-or-more "[" (one-or-more (not (any "]" "\n"))) "]"
- (one-or-more space)))
+ (or (and (one-or-more (and "bug#" (one-or-more digit) ":"))
+ (one-or-more space)
+ (zero-or-more
+ ;; This pattern...
+ "[" (one-or-more (not (any "]" "\n"))) "]"
+ (one-or-more space)))
+ (one-or-more
+ ;; ... is repeated here. Extract it to an rx-let
+ ;; binding once minimum Emacs version is at least
+ ;; 27.
+ "[" (one-or-more (not (any "]" "\n"))) "]"
+ (one-or-more space))))
;; Main subject. A match consists of at least two islands of
;; non-space characters because there's not much point in
;; eliding one word.
diff --git a/tests/piem-lei-tests.el b/tests/piem-lei-tests.el
index 71dc109..dd58360 100644
--- a/tests/piem-lei-tests.el
+++ b/tests/piem-lei-tests.el
@@ -110,7 +110,11 @@
(should (equal (concat "[bug#00000] [PATCH v2] " piem-lei-tests-elide-string)
(piem-lei-query--elide-subject
"[bug#00000] [PATCH] abc def"
- "[bug#00000] [PATCH v2] abc def"))))
+ "[bug#00000] [PATCH v2] abc def")))
+ (should (equal (concat "bug#00000: [PATCH v2] " piem-lei-tests-elide-string)
+ (piem-lei-query--elide-subject
+ "[bug#00000] [PATCH] abc def"
+ "bug#00000: [PATCH v2] abc def"))))
(provide 'piem-lei-tests)
;;; piem-lei-tests.el ends here