Emacs: why is the cursor position less than the expected value?

Suppose I have a source file that is 18218 bytes.

I open the file in emacs and then do:

 M-x end-of-buffer
 M-x what-cursor-position

Why does the cursor position return 17612 bytes?

I think this is due to translating CRLF or dropping CRLF to a single character.

How can I get emacs to report the exact, untranslated character position?

+3
source share
3 answers

The behavior you described is mentioned in manual . None of the ways to get a “true” position is mentioned, which makes me think that you're out of luck.

- , : C-x RET c no-conversion RET C-x C-f filename. .

+2

, find-file-literally Emacs CR LF " ".

0

Perhaps a non-interactive function (dot) is what you need. I did not notice such discrepancies about it, but again - I did not pay much attention to such details ...

0
source

Source: https://habr.com/ru/post/1739021/


All Articles