|
From: | Basil L. Contovounesios |
Subject: | bug#32328: match-beginning: return nil if search failed |
Date: | Wed, 01 Aug 2018 17:39:46 +0300 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Andreas Röhler <andreas.roehler@easy-emacs.de> writes: > match-beginning tells: Return value is undefined if the last search failed. > > Consider it a gain if it returns nil when failing. I think match-string already implicitly relies on the suggested behaviour; compare its docstring: Value is nil if NUMth pair didn't match, or there were less than NUM pairs. with its implementation: (if (match-beginning num) (if string (substring string (match-beginning num) (match-end num)) (buffer-substring (match-beginning num) (match-end num)))) -- Basil
[Prev in Thread] | Current Thread | [Next in Thread] |