summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-12-12 12:05:45 +0100
committerLudovic Courtès <ludo@gnu.org>2024-12-12 12:52:07 +0100
commit8cbbe12eff97e2cc1cdc18300ec62d1ed9b8cdef (patch)
treed5ed035477422ade9170c9d0b53660cb9ae79bfe
parent287be006306d7febad654c23199bcd3ebf8aae85 (diff)
lint: Pre-compile regexp for ‘starts-with-texinfo-markup?’.
* guix/lint.scm (%starts-with-texinfo-markup-rx): New variable. (starts-with-texinfo-markup?): Use it. Change-Id: I1b7a836ba968631f3f358a88a29e996d431b0001
-rw-r--r--guix/lint.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 1ea43df6b3..059ee6894d 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -370,8 +370,11 @@ superfluous when building natively and incorrect when cross-compiling."
(define (properly-starts-sentence? s)
(string-match "^[(\"'`[:upper:][:digit:]]" s))
+(define %starts-with-texinfo-markup-rx
+ (make-regexp "^@(acronym|dfn|code|command|emph|file|quotation|samp|uref|url)\\{.*?\\}"))
+
(define (starts-with-texinfo-markup? s)
- (string-match "^@(acronym|dfn|code|command|emph|file|quotation|samp|uref|url)\\{.*?\\}" s))
+ (regexp-exec %starts-with-texinfo-markup-rx s))
(define (starts-with-abbreviation? s)
"Return #t if S starts with what looks like an abbreviation or acronym."