all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32328: match-beginning: return nil if search failed
@ 2018-07-31  5:59 Andreas Röhler
  2018-08-01 14:39 ` Basil L. Contovounesios
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Röhler @ 2018-07-31  5:59 UTC (permalink / raw)
  To: 32328

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#32328: match-beginning: return nil if search failed
  2018-07-31  5:59 bug#32328: match-beginning: return nil if search failed Andreas Röhler
@ 2018-08-01 14:39 ` Basil L. Contovounesios
  0 siblings, 0 replies; 2+ messages in thread
From: Basil L. Contovounesios @ 2018-08-01 14:39 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 32328

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-01 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31  5:59 bug#32328: match-beginning: return nil if search failed Andreas Röhler
2018-08-01 14:39 ` Basil L. Contovounesios

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.