all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* search-forward in emacs23 lisp
@ 2010-03-27 20:31 rasmith
  2010-03-28 16:39 ` rasmith
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: rasmith @ 2010-03-27 20:31 UTC (permalink / raw)
  To: help-gnu-emacs

The behavior of the search-forward function in emacs-lisp has changed
in emacs23 in a way that breaks some scripts I use, in particular
cgreek-tlg.el from Naoto Takahashi's cgreek package.  This package
includes facilities for reading files in the Thesaurus Linguae Graecae
(TLG) containing both Greek texts and data about those texts, each in
a format unique to the TLG.  Parsing those files requires reading them
into a buffer literally and searching for strings terminated by \xff
(byte 255).  Under emacs22, this only required 
    (search-forward (char-to-string ?\xff))
However, under emacs23, char-to-string with an 8-bit argument (128
through 255) now returns a two-byte string (\x00\xff).  So, these
searches fail.  I tried changing to unibyte-string.  In fact, 
    (unibyte-string ?\377) 
does return a string containing just one byte (255), as I've verified
with what-cursor-position.  However, 
    (search-forward (unibyte-string ?\377)) 
doesn't match an occurrence of 255.  Instead, it matches on the two-byte
string \231\277 (\x99bf).  That two-byte sequence doesn't appear to me
to be a possible Unicode character (I thought the utf-8 representation
of 255 would be \0xc1\0x3f).  Perhaps this is something peculiar to
utf-8-emacs? 

If I move to the buffer that contains the data to be parsed (which has
its multibyte flag set to nil), then 
(search-forward (unibyte-string ?\377)) behaves as above.  However, in
that same buffer, a keyboard isearch-forward for \377 finds a \377
with no problem.  

So, what I need to know is: is there a way to make search-forward find
a single 8-bit byte between 128 and 255?


Robin Smith
Department of Philosophy           rasmith@tamu.edu
Texas A&M University               http://aristotle.tamu.edu/~rasmith/
4237 TAMU                          Voice +1 979 845 5679
College Station, TX 77843-4237     FAX +1 979 845 0458




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-03-29 15:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.