141 reputation
3
bio website barzilay.org
location Massachusetts
age 44
visits member for 3 years, 5 months
seen Apr 6 at 12:02

Jun
12
awarded  Supporter
Jun
2
comment In emacs (or other editor) how to display the byte offset of the cursor?
At least the code above has bigger problems.
Jun
2
comment In emacs (or other editor) how to display the byte offset of the cursor?
Oh, and BTW, my guess is that making up the missing information requires reading the raw contents of the file and find the current point in it -- an exercise that is expensive enough to be impractical to hack into the modeline. (Not impossible though, if you really want to go that way...)
Jun
2
comment In emacs (or other editor) how to display the byte offset of the cursor?
This cannot work in the general case, since you need to deal with encodings that don't have fixed width for all bytes. For a concrete example, try (insert #x1D11E) in some utf-16 file to insert a "G CLEF" character, and you'll see that it takes four bytes. The bottom line is that for a proper answer you need to be able to map the contents of the (decoded) buffer to the raw contents of the file on the disk, and I don't think that Emacs keeps that after the text was decoded. If you know that you only need to deal with 2-byte/char then that's hackable, but not what you asked for...
Jun
1
comment In emacs (or other editor) how to display the byte offset of the cursor?
(1) Displaying the position is easy, but it will work only if you're willing to open files in a literal mode. (2) Re the multibyte toggle: see the emphasized "But" in my answer. (3) You can change how things get displayed, but it's not an easy+quick thing to do (and it makes me think that you really want a hex editor -- did you try that hexl-mode?).
Jun
1
awarded  Teacher
Jun
1
answered In emacs (or other editor) how to display the byte offset of the cursor?
Mar
12
awarded  Autobiographer