aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-06-06 00:22:21 -0400
committerKyle Meyer <kyle@kyleam.com>2020-06-06 15:17:12 -0400
commite81d66e455b1917048aabeb341fdf70334531348 (patch)
treecc5cc5499d648dbce7bb5ca5ea0b5e5c56a62d0d
parenteda0edf3efa9b87b72f9aeb3ac9a905fee0d205a (diff)
downloadpiem-e81d66e455b1917048aabeb341fdf70334531348.tar.gz
Move regexp for patch subjects into a variable
The piem-{notmuch,gnus}-am-ready-mbox functions will need this regexp too.
-rw-r--r--piem.el14
1 files 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)