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
This commit is contained in:
Ludovic Courtès 2024-12-12 12:05:45 +01:00
parent 287be00630
commit 8cbbe12eff
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -370,8 +370,11 @@ superfluous when building natively and incorrect when cross-compiling."
(define (properly-starts-sentence? s) (define (properly-starts-sentence? s)
(string-match "^[(\"'`[:upper:][:digit:]]" 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) (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) (define (starts-with-abbreviation? s)
"Return #t if S starts with what looks like an abbreviation or acronym." "Return #t if S starts with what looks like an abbreviation or acronym."