unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* replacing hexl-mode with nhexl-mode?
@ 2022-03-22 16:49 Alfred M. Szmidt
  2022-03-22 17:59 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2022-03-22 16:49 UTC (permalink / raw)
  To: emacs-devel

Wouldn't it be nice to replace hexl-mode with nhexl-mode?  Are there
any reasons not too?



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-22 16:49 replacing hexl-mode with nhexl-mode? Alfred M. Szmidt
@ 2022-03-22 17:59 ` Eli Zaretskii
  2022-03-22 19:37   ` Alfred M. Szmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-03-22 17:59 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: emacs-devel

> From: "Alfred M. Szmidt" <ams@gnu.org>
> Date: Tue, 22 Mar 2022 12:49:51 -0400
> 
> Wouldn't it be nice to replace hexl-mode with nhexl-mode?  Are there
> any reasons not too?

I think we found nhexl-mode to be much slower in some cases.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-22 17:59 ` Eli Zaretskii
@ 2022-03-22 19:37   ` Alfred M. Szmidt
  2022-03-22 20:03     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2022-03-22 19:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

   > Wouldn't it be nice to replace hexl-mode with nhexl-mode?  Are there
   > any reasons not too?

   I think we found nhexl-mode to be much slower in some cases.

Do you recall what those cases might have been?

Unscientific experiment; I tried opening a 300MiB file, hexl-mode took
about 20 seconds to do anything, while nhexl-mode was instantaneous.
This was with GNU Emacs 27.2.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-22 19:37   ` Alfred M. Szmidt
@ 2022-03-22 20:03     ` Eli Zaretskii
  2022-03-22 20:41       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-03-22 20:03 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: emacs-devel

> From: "Alfred M. Szmidt" <ams@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 22 Mar 2022 15:37:13 -0400
> 
>    > Wouldn't it be nice to replace hexl-mode with nhexl-mode?  Are there
>    > any reasons not too?
> 
>    I think we found nhexl-mode to be much slower in some cases.
> 
> Do you recall what those cases might have been?

Stefan should answer that.  What I remember was 10 years ago, and
maybe was solved since then.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-22 20:03     ` Eli Zaretskii
@ 2022-03-22 20:41       ` Eli Zaretskii
  2022-03-23  7:07         ` Alfred M. Szmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-03-22 20:41 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

> Date: Tue, 22 Mar 2022 22:03:43 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > From: "Alfred M. Szmidt" <ams@gnu.org>
> > Cc: emacs-devel@gnu.org
> > Date: Tue, 22 Mar 2022 15:37:13 -0400
> > 
> >    > Wouldn't it be nice to replace hexl-mode with nhexl-mode?  Are there
> >    > any reasons not too?
> > 
> >    I think we found nhexl-mode to be much slower in some cases.
> > 
> > Do you recall what those cases might have been?
> 
> Stefan should answer that.  What I remember was 10 years ago, and
> maybe was solved since then.

Btw, some problems can be seen almost right away.  Try this:

  C-x C-f etc/HELLO
  M-x nhexl-mode RET

The display is much less tidy, to say the least, than with hexl.el.
It looks like the fancy display of LF is the culprit, at least on my
system (font issues?)  Now try scrolling with C-n, and you will see
stuttering that isn't there with hexl.

There's a also a larger, more subtle problem: nhexl shows you the
internal representation of the buffer text, not what's in the file on
disk; this matters a lot when the file has non-ASCII text.  You need
to be aware of that and visit the file literally if you want to avoid
this issue (there's no nhexl-find-file command).

Finally, nhexl causes display problems when invoked in buffers
text using bidirectional scripts.  Try this:

  C-x C-f etc/tutorials/TUTORIAL.he RET
  M-x nhexl-mode RET

Lots of fun!



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-22 20:41       ` Eli Zaretskii
@ 2022-03-23  7:07         ` Alfred M. Szmidt
  2022-03-23 12:46           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2022-03-23  7:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

   Btw, some problems can be seen almost right away.  Try this:

     C-x C-f etc/HELLO
     M-x nhexl-mode RET

   The display is much less tidy, to say the least, than with hexl.el.
   It looks like the fancy display of LF is the culprit, at least on my
   system (font issues?)  Now try scrolling with C-n, and you will see
   stuttering that isn't there with hexl.

   There's a also a larger, more subtle problem: nhexl shows you the
   internal representation of the buffer text, not what's in the file on
   disk; this matters a lot when the file has non-ASCII text.  You need
   to be aware of that and visit the file literally if you want to avoid
   this issue (there's no nhexl-find-file command).

   Finally, nhexl causes display problems when invoked in buffers
   text using bidirectional scripts.  Try this:

     C-x C-f etc/tutorials/TUTORIAL.he RET
     M-x nhexl-mode RET

These both seem to be because of not visiting the file literally;
something that hexl-mode will do automatically.  That shouldn't be to
hard to fix.

   Lots of fun!

I'm not sure I follow.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-23  7:07         ` Alfred M. Szmidt
@ 2022-03-23 12:46           ` Eli Zaretskii
  2022-03-23 16:47             ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-03-23 12:46 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: emacs-devel

> From: "Alfred M. Szmidt" <ams@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 23 Mar 2022 03:07:25 -0400
> 
>    Btw, some problems can be seen almost right away.  Try this:
> 
>      C-x C-f etc/HELLO
>      M-x nhexl-mode RET
> 
>    The display is much less tidy, to say the least, than with hexl.el.
>    It looks like the fancy display of LF is the culprit, at least on my
>    system (font issues?)  Now try scrolling with C-n, and you will see
>    stuttering that isn't there with hexl.
> 
>    There's a also a larger, more subtle problem: nhexl shows you the
>    internal representation of the buffer text, not what's in the file on
>    disk; this matters a lot when the file has non-ASCII text.  You need
>    to be aware of that and visit the file literally if you want to avoid
>    this issue (there's no nhexl-find-file command).
> 
>    Finally, nhexl causes display problems when invoked in buffers
>    text using bidirectional scripts.  Try this:
> 
>      C-x C-f etc/tutorials/TUTORIAL.he RET
>      M-x nhexl-mode RET
> 
> These both seem to be because of not visiting the file literally;
> something that hexl-mode will do automatically.  That shouldn't be to
> hard to fix.

Feel free to fix that, but at least on my system not all of the issues
I see are solved when I visit the file literally: the jagged display
at the right is still there.  I guess it's somehow caused by the glyph
used to display the LF character (and I expect the same to happen for
TABs), but it is still ugly and should be fixed, IMO.

Another missing feature is the ability to mark and copy the hex
display part.  hexl supports it, but nhexl doesn't, it seems: it can
only copy from the right column, where the actual file's contents are
listed, but not from the hex display part.

I also don't see the equivalents of hexl commands to go to an address,
and to move by words and pages.  Did I miss them?

>    Lots of fun!
> 
> I'm not sure I follow.

I alluded to the funny display and cursor motion in my last example.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-23 12:46           ` Eli Zaretskii
@ 2022-03-23 16:47             ` Stefan Monnier
  2022-03-25  6:59               ` Alfred M. Szmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2022-03-23 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alfred M. Szmidt, emacs-devel

> Feel free to fix that, but at least on my system not all of the issues
> I see are solved when I visit the file literally: the jagged display
> at the right is still there.  I guess it's somehow caused by the glyph
> used to display the LF character (and I expect the same to happen for
> TABs), but it is still ugly and should be fixed, IMO.

Indeed, `nhexl-mode` was not designed as a plug-in replacement for
`hexl-mode`.  If there's a real desire to replace `hexl-mode` with
`nhexl-mode` then Someone™ will need to go and fill those holes.

> Another missing feature is the ability to mark and copy the hex
> display part.  hexl supports it, but nhexl doesn't, it seems: it can
> only copy from the right column, where the actual file's contents are
> listed, but not from the hex display part.

I vaguely remember working on getting some of that working, but I don't
think it's possible to make it work 100% like in hexl-mode (IIRC you
needed to get into `nhexl-nibble-mode` in order to copy/paste the hex
text and then there's the question of whether that should copy only the
hex text, or the combined hex+nonhex text, etc...).


        Stefan




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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-23 16:47             ` Stefan Monnier
@ 2022-03-25  6:59               ` Alfred M. Szmidt
  2022-03-25  7:08                 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2022-03-25  6:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, emacs-devel

There seems like there is a tiny amount of work before this could
straight up replace hexl-mode then.

Not sure my table can fit this, but it sure would be a fun thing to
do.



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

* Re: replacing hexl-mode with nhexl-mode?
  2022-03-25  6:59               ` Alfred M. Szmidt
@ 2022-03-25  7:08                 ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-03-25  7:08 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: monnier, emacs-devel

> From: "Alfred M. Szmidt" <ams@gnu.org>
> Date: Fri, 25 Mar 2022 02:59:53 -0400
> Cc: eliz@gnu.org, emacs-devel@gnu.org
> 
> There seems like there is a tiny amount of work before this could
> straight up replace hexl-mode then.

Given what Stefan said:

> Indeed, `nhexl-mode` was not designed as a plug-in replacement for
> `hexl-mode`.

I'm not so sure that it's only a tiny amount of work.  Fixing design
problems never is, IME.  However, ...

> Not sure my table can fit this, but it sure would be a fun thing to
> do.

... I certainly don't want to discourage you or anyone else to work on
adding the missing features, and then we could revisit this issue.



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

end of thread, other threads:[~2022-03-25  7:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 16:49 replacing hexl-mode with nhexl-mode? Alfred M. Szmidt
2022-03-22 17:59 ` Eli Zaretskii
2022-03-22 19:37   ` Alfred M. Szmidt
2022-03-22 20:03     ` Eli Zaretskii
2022-03-22 20:41       ` Eli Zaretskii
2022-03-23  7:07         ` Alfred M. Szmidt
2022-03-23 12:46           ` Eli Zaretskii
2022-03-23 16:47             ` Stefan Monnier
2022-03-25  6:59               ` Alfred M. Szmidt
2022-03-25  7:08                 ` 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).