summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-01-29 21:47:16 -0500
committerKyle Meyer <kyle@kyleam.com>2021-01-29 21:47:16 -0500
commit656625e1f9628673c285e3357329aaa6f6e48843 (patch)
tree9f346c932962e4f773de27c9e83c25aa52076292
parent2f938bf59a901ef97c44d92ab2deea7f2588f55d (diff)
downloadpiem-656625e1f9628673c285e3357329aaa6f6e48843.tar.gz
Prefer string-suffix-p to string-match-p
It's faster and to my eyes slightly more readable. This changes the behavior of piem--ensure-trailing-slash for the edge case of "/". While I think the new behavior makes more sense, it doesn't matter in practice.
-rw-r--r--piem.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/piem.el b/piem.el
index 867a7e5..7b198d1 100644
--- a/piem.el
+++ b/piem.el
@@ -286,7 +286,7 @@ Functions should accept one argument, the message ID given to
;;;; Extractors
(defun piem--ensure-trailing-slash (s)
- (if (string-match-p ".+/\\'" s) s (concat s "/")))
+ (if (string-suffix-p "/" s) s (concat s "/")))
(defun piem-message-link-re (url &optional mid)
"Return a regular expression matching a public-inbox url.
@@ -582,7 +582,7 @@ This function depends on :url being configured for entries in
(or (member type '("text/x-diff" "text/x-patch"))
(and filename
(equal type "text/plain")
- (string-match-p "\\.patch\\'" filename))))
+ (string-suffix-p ".patch" filename t))))
(with-temp-buffer
(mm-display-inline handle)
(buffer-substring-no-properties (point-min) (point-max)))))