bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4209: 23.1; Emacs 23.1 regression in re-search-forward


From: Chong Yidong
Subject: bug#4209: 23.1; Emacs 23.1 regression in re-search-forward
Date: Wed, 27 Jan 2010 11:43:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> The preceding comment keeps me puzzled.  I thought that we only ever
> matched re_patterns and buffers of the same multibyteness, i.e. if
> a unibyte regexp is matched against a multibyte buffer it should first
> be turned into a multibyte regexp and then re_compiled, so the case of:
>
>                 /* For the case of matching this unibyte regex
>                    against multibyte, we must set a leading code of
>                    the corresponding multibyte character.  */
>
> should never happen in analyse_first.  Yet, if your patch fixes the bug,
> that indicates that apparently it *does* happen.

I observe that in the original bug recipe:

  (set-buffer (get-buffer-create "*Test Buffer*"))
  (insert "\xC2\x4C\xEF\x77\xC6\x69\x8C\x0A")
  (goto-char (point-min))
  (message "looking-at: %s" (looking-at "\\`\xC2\x4C\xEF\x77\xC6\x69\x8C\x0A"))
  (message "re-search-forward: %s"
           (re-search-forward "\\`\xC2\x4C\xEF\x77\xC6\x69\x8C\x0A" 100 t))

If we replace

  (re-search-forward "\\`\xC2\x4C\xEF\x77\xC6\x69\x8C\x0A" 100 t))

with

  (re-search-forward (string-to-multibyte
                       "\\`\xC2\x4C\xEF\x77\xC6\x69\x8C\x0A") 100 t))

then the regexp match takes places correctly.  I'm not sure why the
looking-at call works, tho.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]