unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: 9458@debbugs.gnu.org
Subject: bug#9458: 24.0.50; Searching in binary buffers
Date: Wed, 07 Sep 2011 14:50:29 +0200	[thread overview]
Message-ID: <m2r53s7bze.fsf@gmail.com> (raw)

search-forward seems to work strangely in binary/unibyte buffers.
Create a file test.el containing this code:

(defvar test-string (unibyte-string #xce))

(with-temp-file "test.txt"
  (set-buffer-multibyte nil)
  (setq buffer-file-coding-system 'binary)
  (insert test-string))

(with-current-buffer (get-buffer-create "test.txt")
  (set-buffer-multibyte nil)
  (setq buffer-file-coding-system 'binary)
  (erase-buffer)
  (insert-file-contents "test.txt")
  (search-forward test-string))

Executing this with: emacs -Q -batch -l test.el
prints: 
Search failed: "Î"
[Exit 255]


The Lisp code creates a file test.txt for a single character ?\xce.  As
expected, hexdump -C test.txt prints: 
00000000  ce                                                |Î|
00000001


Opening and searching that character with Emacs fails.  That's
definitely not what I was expecting.  What's the proper way to search
those characters?






In GNU Emacs 24.0.50.4 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2011-09-05 on ix
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--enable-asserts' '--enable-checking' '--with-gif=no' '--with-gnutls=no' 'CFLAGS=-g3 -O0''






             reply	other threads:[~2011-09-07 12:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 12:50 Helmut Eller [this message]
2011-09-07 16:09 ` bug#9458: 24.0.50; Searching in binary buffers Andreas Schwab
2011-09-07 16:51 ` Andreas Schwab

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r53s7bze.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=9458@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).