bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Igor Saprykin
hexl-mode doesn't seem to allow me to create a binary file.

Steps:
1. Open Emacs
2. Create a new file using C-x C-f /tmp/boot-sect.bin
3. M-x hexl-mode
4. M-x hexl-insert-hex-char
5. e
6. Nothing is written into the buffer and the message buffer says "Point is not on a character file".

I took a brief look at the source code and it appears that (hexl-current-address) expected the cursor to not be in the top left (0,0) location of the buffer.  Normally in hexl-mode those columns are going to be occupied by addresses.  Yet, that's exactly where the cursor is because that's an empty file.

I tried on my two Macs and on a Linux box too.
It works as expected if I do "echo 0 > /tmp/boot-sect.bin" first so that the file isn't empty.

Cheers,
Igor
-----

In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
 of 2020-08-11 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.6

Recent messages:
Loading paren...done
[yas] Prepared just-in-time loading of snippets successfully.
Loading server...done
Users/igor/.emacs.d/elpa/justify-kp/justify-kp.el: ‘flet’ is an obsolete macro (as of 24.3); use either ‘cl-flet’ or ‘cl-letf’. [2 times]
Key Chord mode on
For information about GNU Emacs and the GNU system, type C-h C-a.
Package cl is deprecated
(New file)
hexl-current-address: Point is not on a character in the file

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Hexl

Minor modes in effect:
  ruler-mode: t
  hl-line-mode: t
  hexl-follow-ascii: t
  hexl-follow-ascii-mode: t
  global-emojify-mode: t
  emojify-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  evil-mode: t
  evil-local-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  winum-mode: t
  pyvenv-mode: t
  shell-dirtrack-mode: t
  window-number-meta-mode: t
  window-number-mode: t
  global-linum-mode: t
  linum-mode: t
  global-auto-revert-mode: t
  ido-everywhere: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
epg epg-config gnus-util rmail rmail-loaddefs text-property-search
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils ruler-mode hl-line hexl ffap emojify apropos tar-mode
arc-mode archive-mode ht key-chord evil evil-keybindings
evil-integration undo-tree diff evil-maps evil-commands reveal flyspell
ispell evil-jumps evil-command-window evil-types evil-search evil-ex
evil-macros evil-repeat evil-states evil-core evil-common windmove rect
evil-digraphs evil-vars monokai-theme justify-kp dash-functional keyfreq
em-term term disp-table ehelp server winum no-littering flycheck dash
yasnippet highlight-indentation flymake-proc flymake warnings thingatpt
company-capf company help-fns elpy elpy-rpc pcase pyvenv eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
elpy-shell rx elpy-profile elpy-django s elpy-refactor derived edmacro
kmacro python tramp-sh tramp tramp-loaddefs trampver tramp-integration
tramp-compat shell parse-time iso8601 ls-lisp grep compile files-x etags
fileloop generator xref project cus-edit wid-edit use-package-ensure
use-package-core exec-path-from-shell finder-inf org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete comint ansi-color ring org-list org-faces
org-entities time-date noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
window-number linum advice el-get el-get-autoloading
el-get-list-packages el-get-dependencies el-get-build el-get-status pp
el-get-methods el-get-fossil el-get-svn el-get-pacman el-get-github-zip
el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go
el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify
el-get-emacsmirror el-get-github el-get-git el-get-elpa el-get-darcs
el-get-cvs el-get-bzr el-get-brew el-get-builtin el-get-apt-get
el-get-recipes el-get-byte-compile el-get-custom cl-extra help-mode
el-get-core autoload radix-tree lisp-mnt cl dired dired-loaddefs
autorevert filenotify ido sanityinc-solarized-light-theme
color-theme-sanityinc-solarized paren time cus-start cus-load info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 503465 28220)
 (symbols 48 33655 5)
 (strings 32 198733 5278)
 (string-bytes 1 4888032)
 (vectors 16 76343)
 (vector-slots 8 2595040 48026)
 (floats 8 179 51)
 (intervals 56 396 0)
 (buffers 1000 13))
Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Eli Zaretskii
tags 43231 notabug
thanks

> From: Igor Saprykin <[hidden email]>
> Date: Sat, 5 Sep 2020 12:22:42 -0700
>
> hexl-mode doesn't seem to allow me to create a binary file.
>
> Steps:
> 1. Open Emacs
> 2. Create a new file using C-x C-f /tmp/boot-sect.bin
> 3. M-x hexl-mode
> 4. M-x hexl-insert-hex-char
> 5. e
> 6. Nothing is written into the buffer and the message buffer says "Point is not on a character file".

hexl-mode doesn't support adding or deleting characters, it only
supports replacing them.  E.g., hexl-insert-hex-char _replaces_ the
character at point with what you type.  So what you see is what this
mode is supposed to do: it is based on the assumption that the size of
the file you are editing shouldn't be changed.

If you want to create a file from scratch, why do you need hexl-mode?
You can type bytes in hex or octal using C-q.



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Lars Ingebrigtsen
Eli Zaretskii <[hidden email]> writes:

>> 4. M-x hexl-insert-hex-char
>> 5. e
>> 6. Nothing is written into the buffer and the message buffer says
>> "Point is not on a character file".
>
> hexl-mode doesn't support adding or deleting characters, it only
> supports replacing them.

The error message could be more helpful, though?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Eli Zaretskii
> From: Lars Ingebrigtsen <[hidden email]>
> Cc: Igor Saprykin <[hidden email]>,  [hidden email]
> Date: Sun, 06 Sep 2020 16:40:22 +0200
>
> > hexl-mode doesn't support adding or deleting characters, it only
> > supports replacing them.
>
> The error message could be more helpful, though?

Feel free to suggest a better message.



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Lars Ingebrigtsen
In reply to this post by Eli Zaretskii
Eli Zaretskii <[hidden email]> writes:

>> 6. Nothing is written into the buffer and the message buffer says
>> "Point is not on a character file".

[...]

>> The error message could be more helpful, though?
>
> Feel free to suggest a better message.

I see now that the error message isn't really "Point is not on a
character file" (which I found very confusing), but instead "Point is
not on a character in the file", which I think is OK.

So I agree that there's nothing here to fix, and I'm closing this bug
report.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Igor Saprykin
Thanks for taking a look.  I thought it might be the case that it's
for replacing them.

I do find it confusing, because
1) "insert" in the name of the function.
2) "C-h f" for that function talks about inserting.
3) "C-h f" for hexl-mode talks about inserting.

Admittedly nothing talks about "deleting" things.

Thanks for the C-q pointer.

Best,
Igor

On Sun, Sep 6, 2020 at 10:25 AM Lars Ingebrigtsen <[hidden email]> wrote:

>
> Eli Zaretskii <[hidden email]> writes:
>
> >> 6. Nothing is written into the buffer and the message buffer says
> >> "Point is not on a character file".
>
> [...]
>
> >> The error message could be more helpful, though?
> >
> > Feel free to suggest a better message.
>
> I see now that the error message isn't really "Point is not on a
> character file" (which I found very confusing), but instead "Point is
> not on a character in the file", which I think is OK.
>
> So I agree that there's nothing here to fix, and I'm closing this bug
> report.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Emacs - Bugs mailing list
In reply to this post by Eli Zaretskii
Eli Zaretskii <[hidden email]> writes:
>
> Feel free to suggest a better message.

Is there any operation that hexl-mode provides that makes sense when the
buffer is empty? If not, then maybe we could refuse to enable hexl-mode
in an empty buffer, and print a descriptive message.

--
Daniel Martín



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Eli Zaretskii
> From: Daniel Martín <[hidden email]>
> Cc: Lars Ingebrigtsen <[hidden email]>,  [hidden email],
>   [hidden email]
> Date: Mon, 07 Sep 2020 00:10:54 +0200
>
> Is there any operation that hexl-mode provides that makes sense when the
> buffer is empty? If not, then maybe we could refuse to enable hexl-mode
> in an empty buffer, and print a descriptive message.

hexl-mode-exit?



Reply | Threaded
Open this post in threaded view
|

bug#43231: 27.1; hexl-insert-hex-char on an empty file "hexl-current-address: Point is not on a character in the file".

Emacs - Bugs mailing list
Eli Zaretskii <[hidden email]> writes:
>
> hexl-mode-exit?

Then what's the point in letting a user enable hexl-mode in a situation
where the only useful thing they can do is exiting the mode?