diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-25 09:50:34 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-25 09:50:34 +0200 |
| commit | b377adb68c8d124d6d6ef1cba21ac7862c6cb1c3 (patch) | |
| tree | c10a17d20c74335ded82ad0ea09009c46d57dc4e /lisp/magit-bisect.el | |
| parent | eda5d3682ab8af3961232d0d026c3a4b12adf3c2 (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-bisect.el')
| -rw-r--r-- | lisp/magit-bisect.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el index 8c737c1..baf1428 100644 --- a/lisp/magit-bisect.el +++ b/lisp/magit-bisect.el @@ -258,7 +258,7 @@ bisect run'." (pop lines)) (seq-find (##string-match done-re %) lines)))) (magit-insert-section ((eval (if bad-line 'commit 'bisect-output)) - (and bad-line (match-string 1 bad-line))) + (and bad-line (match-str 1 bad-line))) (magit-insert-heading (propertize (or bad-line (pop lines)) 'font-lock-face 'magit-section-heading)) @@ -291,7 +291,7 @@ bisect run'." (while (progn (setq beg (point-marker)) (re-search-forward "^\\(\\(?:git bisect\\|# status:\\) [^\n]+\n\\)" nil t)) - (if (string-prefix-p "# status:" (match-string 1)) + (if (string-prefix-p "# status:" (match-str 1)) (magit-delete-match) (magit-bind-match-strings (heading) nil (magit-delete-match) @@ -315,4 +315,9 @@ bisect run'." ;;; _ (provide 'magit-bisect) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-bisect.el ends here |
