From 656625e1f9628673c285e3357329aaa6f6e48843 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 29 Jan 2021 21:47:16 -0500 Subject: 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. --- piem.el | 4 ++-- 1 file 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))))) -- cgit v1.2.3