From: Lennart Borgman <lennart.borgman@gmail.com>
To: rasmith@tamu.edu
Cc: help-gnu-emacs@gnu.org
Subject: Re: search-forward in emacs23 lisp
Date: Sun, 28 Mar 2010 19:10:59 +0200 [thread overview]
Message-ID: <e01d8a51003281010i684fcf7fif906ace210700ffe@mail.gmail.com> (raw)
In-Reply-To: <20100328.120401.200754749763864021.rasmith@aristotle.tamu.edu>
On Sun, Mar 28, 2010 at 7:04 PM, <rasmith@tamu.edu> wrote:
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Subject: Re: search-forward in emacs23 lisp
> Date: Sun, 28 Mar 2010 18:50:46 +0200
>
>> On Sun, Mar 28, 2010 at 6:39 PM, <rasmith@tamu.edu> wrote:> Sorry to
>> reply to my own post, but the following rather ugly solution
>>> solves the problem of finding a single FF byte:
>>> (while (/= (char-after) ?\377)
>>> (forward-char 1)
>>> )
>>> (forward-char 1)
>>> This replaces
>>> (search-forward (unibyte-string ?\377))
>>> which, in emacs23, no matter what I do, insists on turning the byte
>>> into the two-byte string \231\277 before searching.
>>>
>>> But surely there's a better way?
>>
>> Hi Robin,
>>
>> Someone else knows this much better than me and can explain the
>> details, but I believe that unibyte-string is a low level function
>> that you do not need here.
>>
>> How about just
>>
>> (search-forward (char-to-string ?\377))
>> or (search-forward (char-to-string 255))
>>
>> Does that work for you?
>
> Nope. That's exactly what caused the original problem (that is, the
> code that broke was exactly what you suggest). Using either one of
> these, what search-forward will look for is a two-byte string (in
> other words, it undertakes to convert the high 8-bit character into
> something like a utf-8 representation of it (\377 can't occur as the
> first byte of a utf-8 character, which is probably what triggers
> this).
Oh, sorry. I read your first message now. It looks like you have found
a problem with search-forward in this case and a bug in isearch. I
suggest that you file a bug report.
next prev parent reply other threads:[~2010-03-28 17:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-27 20:31 search-forward in emacs23 lisp rasmith
2010-03-28 16:39 ` rasmith
2010-03-28 16:50 ` Lennart Borgman
2010-03-28 17:04 ` rasmith
2010-03-28 17:10 ` Lennart Borgman [this message]
2010-03-28 17:56 ` rasmith
2010-03-28 17:59 ` rasmith
2010-03-28 18:22 ` Lennart Borgman
2010-03-28 21:45 ` Peter Dyballa
2010-03-29 0:44 ` rasmith
2010-03-28 23:00 ` Johan Bockgård
2010-03-29 6:51 ` Eli Zaretskii
2010-03-29 15:01 ` rasmith
2010-03-29 15:17 ` Eli Zaretskii
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=e01d8a51003281010i684fcf7fif906ace210700ffe@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=rasmith@tamu.edu \
/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.