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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32328 in the body.
You can then email your comments to 32328 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32328; Package emacs. (Tue, 31 Jul 2018 05:57:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 31 Jul 2018 05:57:02 GMT) Full text and rfc822 format available.

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

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: match-beginning: return nil if search failed
Date: Tue, 31 Jul 2018 07:59:06 +0200
match-beginning tells: Return value is undefined if the last search failed.

Consider it a gain if it returns nil when failing.

Thanks,
Andreas
GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5) of 
2018-05-29




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32328; Package emacs. (Wed, 01 Aug 2018 14:40:01 GMT) Full text and rfc822 format available.

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




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 03:07:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 32328 <at> debbugs.gnu.org and Andreas Röhler <andreas.roehler <at> easy-emacs.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 03:07:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 10 Aug 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 261 days ago.

Previous Next


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