Subject: Re: bug#73951: 29.4; 'what-cursor-position' reports SPC instead of TAB in term-mode

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 Nov 2024 18:39:13 +0200

> From: Toomas Rosin <[email-masked]>
> cc: [email-masked]
> Comments: In-reply-to Eli Zaretskii <[email-masked]>
>    message dated "Wed, 23 Oct 2024 20:47:17 +0300."
> Date: Sun, 03 Nov 2024 17:50:37 +0200
> 
> Eli Zaretskii <[email-masked]> wrote:
> 
> > OK, so why is it a problem that Emacs uses SPC character to emulate a
> > TAB?
> 
> It is confusing when you don't happen to know about it.
> 
> I did not know about it before writing the OP.  I had this function definition in a shell script (where "<TAB>" denotes the tab character):
> 
>     tawk () { awk -F '<TAB>' -v OFS='<TAB>' "$@"; }  # run awk on tab delimited files
> 
> When I yanked this definition from the script to the "*terminal*" buffer and tried to use it, I happened to get unexpected results (which, as it turned out later, were in fact not connected to this definition), and the first thing I suspected was (quite naturally imho) that something was wrong with the tab characters in the definition of the function.  To check the definition, I ran "type tawk" in the *terminal* buffer, switched to line mode (C-c C-j), moved the cursor to the tab chars, ran `what-cursor-position' — and indeed, it told me that there were spaces there instead of tabs!  So I was confirmed in my barking up the wrong tree.

Did you try setting indent-tabs-mode to a non-nil value?