aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-remote.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-07-25 09:50:34 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-07-25 09:50:34 +0200
commitb377adb68c8d124d6d6ef1cba21ac7862c6cb1c3 (patch)
treec10a17d20c74335ded82ad0ea09009c46d57dc4e /lisp/magit-remote.el
parenteda5d3682ab8af3961232d0d026c3a4b12adf3c2 (diff)
Use shorthand match-str instead of match-string-no-properties
Almost always would it be better to use `match-string-no-properties' instead of `match-string', but because the name of the former is excruciatingly long for a function that one often wants to use in tight spaces and because it usually "does not really matter", I usually went for the latter. The problem is, it does matter. For example, even strings that are usually only used by code may end up obfuscating debug statements. So let's start doing the right thing, even though there surely will be people frowning at the use of a shorthand. The fake ("match-string" "match-string") shorthand is necessary to protect literal `match-string' and `match-string-no-properties' from being corrupted by interpreted as shorthand for the non-existent `match-stringing' and `match-string-no-propertiesing'. Unfortunately the shorthands have to be specified in each library individually. Using "dir-locals.el" only works if the libraries are compiled. At least this additional noise is neatly tucked away at the end of the files. It might turn out that out of the more than two hundred instances where this replaces `match-string' with `match-string-no-properties' we should have stuck with the former in an instance or two. That's the price of progress and can be fixed once such regressions are reported.
Diffstat (limited to 'lisp/magit-remote.el')
-rw-r--r--lisp/magit-remote.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index e4cdab7..6822fac 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -175,8 +175,8 @@ the now stale refspecs. Other stale branches are not removed."
stale)
(dolist (refspec refspecs)
(when (string-match magit--refspec-re refspec)
- (let ((theirs (match-string 2 refspec))
- (ours (match-string 3 refspec)))
+ (let ((theirs (match-str 2 refspec))
+ (ours (match-str 3 refspec)))
(unless (if (string-match "\\*" theirs)
(let ((re (replace-match ".*" t t theirs)))
(seq-some (##string-match-p re %) remote-refs))
@@ -393,4 +393,9 @@ refspec."
;;; _
(provide 'magit-remote)
+;; Local Variables:
+;; read-symbol-shorthands: (
+;; ("match-string" . "match-string")
+;; ("match-str" . "match-string-no-properties"))
+;; End:
;;; magit-remote.el ends here