From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: search-forward in emacs23 lisp Date: Sun, 28 Mar 2010 19:10:59 +0200 Message-ID: References: <20100327.153148.886429907165788179.rasmith@aristotle.tamu.edu> <20100328.113915.866357745907943848.rasmith@aristotle.tamu.edu> <20100328.120401.200754749763864021.rasmith@aristotle.tamu.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1269796529 31511 80.91.229.12 (28 Mar 2010 17:15:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Mar 2010 17:15:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: rasmith@tamu.edu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 28 19:15:25 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nvw56-0001wu-2R for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Mar 2010 19:15:24 +0200 Original-Received: from localhost ([127.0.0.1]:55384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nvw55-0004wB-7U for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Mar 2010 13:15:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nvw1D-00044Y-CQ for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:11:23 -0400 Original-Received: from [140.186.70.92] (port=40488 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nvw1B-00043s-V0 for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:11:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nvw1A-0007yp-E9 for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:11:21 -0400 Original-Received: from mail-fx0-f224.google.com ([209.85.220.224]:37450) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nvw1A-0007yh-4j for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:11:20 -0400 Original-Received: by fxm24 with SMTP id 24so5000fxm.26 for ; Sun, 28 Mar 2010 10:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=MtJAvH33En3v16VKpeUptrLjqtgOzJ9fulsOXSFoLwI=; b=EHE6Od7GLiV0Bkrw5orcgQ+d0P2arINeHi42JAvgIJx0kVNsvGxHt8YnFs3eC7dVY0 HPyHp2JdB0/U61UzBCBC1JoJT40yFAZyMsmTWCB7S7fUV2WFBce7+syE4AuGZe27/hln mdOR//jYs3grFG8TxFJqPBi6wwIrTshP/sL0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=yFVWSC/wT3XHavRQtNPGa+MYxfXGKKl/Maemv7eQxq8q++ZhOvkPvE+0rbN0gzCfJV GXF6HWQ5sGe7ai2dAA0H+Iexx/nIiXGmCilyywykWaTnxTxf9Lndf/g2LPAhdoM6n7oE z4iekGy/s2yKWM1ccdqHbfBhAwdAqG7BynaTo= Original-Received: by 10.239.140.200 with HTTP; Sun, 28 Mar 2010 10:10:59 -0700 (PDT) In-Reply-To: <20100328.120401.200754749763864021.rasmith@aristotle.tamu.edu> Original-Received: by 10.239.134.13 with SMTP id 13mr342111hbx.195.1269796279088; Sun, 28 Mar 2010 10:11:19 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72517 Archived-At: On Sun, Mar 28, 2010 at 7:04 PM, wrote: > From: Lennart Borgman > 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, =C2=A0 wrote:> Sorry = to >> reply to my own post, but the following rather ugly solution >>> solves the problem of finding a single FF byte: >>> =C2=A0 =C2=A0 =C2=A0(while (/=3D (char-after) ?\377) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-char 1) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0) >>> =C2=A0 =C2=A0 =C2=A0(forward-char 1) >>> This replaces >>> =C2=A0 =C2=A0 =C2=A0(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 >> >> =C2=A0 =C2=A0(search-forward (char-to-string ?\377)) >> =C2=A0 =C2=A0or (search-forward (char-to-string 255)) >> >> Does that work for you? > > Nope. =C2=A0That's exactly what caused the original problem (that is, the > code that broke was exactly what you suggest). =C2=A0Using 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.