unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* hexl-mode: searching for multi byte sequence?
@ 2015-07-13 17:55 Alfred M. Szmidt
  2015-07-14  7:07 ` Stephen J. Turnbull
  0 siblings, 1 reply; 3+ messages in thread
From: Alfred M. Szmidt @ 2015-07-13 17:55 UTC (permalink / raw)
  To: emacs-devel

Is there some way in hexl-mode to  search for a (hex, octal, ...) byte
sequence?  Currently, C-s behaves a  bit strange in at least two regards:

1) If  file contains  the byte sequence  #xDEADBEAF, depending  on how
   they are  aligned (odd  or even  word), one has  to look  for "DEAD
   BEAF" and "DE ADBE AF".

   00000000: dead beaf 0000 0000 0000 0000 0000 0000  ................
   00000000: 00de adbe af00 0000 0000 0000 0000 0000  ................

2) If the byte sequence continues on a new line, i.e.

   00000000: 0000 0000 0000 0000 0000 0000 0000 dead  ................
   00000010: beaf 0000 0000 0000 0000 0000 0000 0000  ................

   Then it is impossible to find the string at all.

Cheers, Alfred.



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

* hexl-mode: searching for multi byte sequence?
  2015-07-13 17:55 hexl-mode: searching for multi byte sequence? Alfred M. Szmidt
@ 2015-07-14  7:07 ` Stephen J. Turnbull
  2015-07-14 14:51   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen J. Turnbull @ 2015-07-14  7:07 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: emacs-devel

Alfred M. Szmidt writes:
 > Is there some way in hexl-mode to  search for a (hex, octal, ...) byte
 > sequence?  Currently, C-s behaves a  bit strange in at least two regards:
 > 
 > 1) If  file contains  the byte sequence  #xDEADBEAF, depending  on how
 >    they are  aligned (odd  or even  word), one has  to look  for "DEAD
 >    BEAF" and "DE ADBE AF".

C-u C-s de\(.\n\)*ad\(.\|\n\)*be\(.\|\n\)*af

is what I'd use.  It has obvious defects, and it would be nice if
hexl-mode provided something a little less greedy (eg a transformation
to a 3-armed disjunction allowing at most one newline plus handling
the leading byte number after the newline).




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

* Re: hexl-mode: searching for multi byte sequence?
  2015-07-14  7:07 ` Stephen J. Turnbull
@ 2015-07-14 14:51   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2015-07-14 14:51 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: ams, emacs-devel

> From: "Stephen J. Turnbull" <stephen@xemacs.org>
> Date: Tue, 14 Jul 2015 16:07:47 +0900
> Cc: emacs-devel@gnu.org
> 
> Alfred M. Szmidt writes:
>  > Is there some way in hexl-mode to  search for a (hex, octal, ...) byte
>  > sequence?  Currently, C-s behaves a  bit strange in at least two regards:
>  > 
>  > 1) If  file contains  the byte sequence  #xDEADBEAF, depending  on how
>  >    they are  aligned (odd  or even  word), one has  to look  for "DEAD
>  >    BEAF" and "DE ADBE AF".
> 
> C-u C-s de\(.\n\)*ad\(.\|\n\)*be\(.\|\n\)*af
> 
> is what I'd use.  It has obvious defects, and it would be nice if
> hexl-mode provided something a little less greedy (eg a transformation
> to a 3-armed disjunction allowing at most one newline plus handling
> the leading byte number after the newline).

Hexl already provides something similar, see
hexl-isearch-search-function.  It allows to search in the text column
strings that span multiple lines, for example.  It should be enhanced
to support Alfred's use case (and somebody please document it!).



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

end of thread, other threads:[~2015-07-14 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-13 17:55 hexl-mode: searching for multi byte sequence? Alfred M. Szmidt
2015-07-14  7:07 ` Stephen J. Turnbull
2015-07-14 14:51   ` Eli Zaretskii

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).