GNU bug report logs - #20806
25.0.50; `string-match' is confused???

Previous Next

Package: emacs;

Reported by: Vaidheeswaran C <vaidheeswaran.chinnaraju <at> gmail.com>

Date: Sat, 13 Jun 2015 18:43:04 UTC

Severity: minor

Tags: notabug

Found in version 25.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Vaidheeswaran C <vaidheeswaran.chinnaraju <at> gmail.com>
Cc: 20806 <at> debbugs.gnu.org
Subject: bug#20806: 25.0.50;  `string-match' is confused???
Date: Sun, 14 Jun 2015 09:40:33 -0400
tags 20806 notabug
thanks

> Is an empty string a prefix of all strings or not?

Yes, but that's unrelated to the uncaught signal you show, nor to the
two string-match calls you show.

> Welcome to the Emacs shell
> /tmp $ (string-match "\\(.*\\)" "")
> 0

Yup, we can find a trivial match for "\\(.*\\)" in the empty string.

> /tmp $ (string-match "foo" "")

And "foo" can't be found in the empty string.

> Here is how I ended up with this bug.
> Debugger entered--Lisp error: (error "Regexp cannot match an empty string")
[...]
>   command-execute(highlight-regexp)

And this is "not a bug but a feature".  This could arguably
be improved.  E.g. it should probably call `user-error'.
But highlight-regexp is simply telling you that it's not a good idea to
try to highlight all the empty strings in your buffer: not only there
are many (e.g. as many as point-max), but you wouldn't notice that
they're highlighted anyway.


        Stefan




This bug report was last modified 9 years and 121 days ago.

Previous Next


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