From e81d66e455b1917048aabeb341fdf70334531348 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 6 Jun 2020 00:22:21 -0400 Subject: Move regexp for patch subjects into a variable The piem-{notmuch,gnus}-am-ready-mbox functions will need this regexp too. --- piem.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/piem.el b/piem.el index eb725d0..e297930 100644 --- a/piem.el +++ b/piem.el @@ -312,6 +312,13 @@ the first will be ignored." (plist-put info :base-commit (match-string 1))) info))) +(defvar piem-patch-subject-re + (rx string-start (zero-or-more space) "[" + (zero-or-more (not (any "]" "\n"))) + "PATCH" + (zero-or-more (not (any "]" "\n"))) + "]" (one-or-more space))) + (defun piem--shorten-subject (subject) (let ((words (mapcar #'downcase @@ -321,12 +328,7 @@ the first will be ignored." (rx (any "'\"")) "") (replace-regexp-in-string - (rx string-start (zero-or-more space) "[" - (zero-or-more (not (any "]" "\n"))) - "PATCH" - (zero-or-more (not (any "]" "\n"))) - "]" (one-or-more space)) - "")) + piem-patch-subject-re "")) "\\W+" t))) (ignore-these (list "a" "an" "the")) (num-words 0) -- cgit v1.2.3