GNU bug report logs - #32328
match-beginning: return nil if search failed

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Tue, 31 Jul 2018 05:57:01 UTC

Severity: wishlist

Tags: notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 32328 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 32328 <at> debbugs.gnu.org
Subject: Re: bug#32328: match-beginning: return nil if search failed
Date: Wed, 01 Aug 2018 17:39:46 +0300
Andreas Röhler <andreas.roehler <at> 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




This bug report was last modified 5 years and 320 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.