all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com>
Cc: 20806@debbugs.gnu.org
Subject: bug#20806: 25.0.50;  `string-match' is confused???
Date: Sun, 14 Jun 2015 09:40:33 -0400	[thread overview]
Message-ID: <jwvpp4yl8eo.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <557BF8E9.9040007@gmail.com> (Vaidheeswaran C.'s message of "Sat,  13 Jun 2015 15:03:29 +0530")

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





      parent reply	other threads:[~2015-06-14 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-13  9:33 bug#20806: 25.0.50; `string-match' is confused??? Vaidheeswaran C
2015-06-13 18:59 ` Vaidheeswaran C
2015-06-14 20:18   ` Stefan Monnier
2015-06-13 19:21 ` Andreas Schwab
2015-06-13 22:58 ` Michael Heerdegen
2015-06-14 13:40 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvpp4yl8eo.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=20806@debbugs.gnu.org \
    --cc=vaidheeswaran.chinnaraju@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.