GNU bug report logs - #20950
25.0.50; string-match in IELM operates on a wrong string

Previous Next

Package: emacs;

Reported by: Oleg Sivokon <olegsivokon <at> gmail.com>

Date: Wed, 1 Jul 2015 15:12:02 UTC

Severity: normal

Tags: notabug

Found in version 25.0.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Oleg Sivokon <olegsivokon <at> gmail.com>
Cc: 20950 <at> debbugs.gnu.org
Subject: Re: bug#20950: 25.0.50;
 string-match in IELM operates on a wrong string
Date: Wed, 01 Jul 2015 18:51:00 +0300
> From: Oleg Sivokon <olegsivokon <at> gmail.com>
> Date: Wed, 01 Jul 2015 18:08:10 +0300
> 
> The problem is as follows. When `string-match` is called in IELM, while
> it searches in the correct string, `match-string` will operate on the
> contents of IELM buffer instead of the string being searched.  Below is
> a concrete example.  Consider this function:
> 
> (defun sphinx-parse-node (raw)
>   (let ((pos 0) result)
>     (while (string-match "'\\([^']+\\)'" raw pos)
>       (push (match-string 1) result)
>       (setq pos (match-end 0)))
>     (nreverse result)))

You need to pass the original string to match-string, when you match a
string and not buffer text.




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

Previous Next


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