I am looking for a command I can enter that will make the TAB key input an actual TAB character.
I'm open to anything that is temporary or that will not stomp on TAB mappings that do things other than indenting the cursor (like autocompletion etc). i.e. any or all of these cases would be great to know about:
- It can be permanent and affect all major modes as long as it will not affect anything other than indentation of the cursor. (AFAICT, any permanent changes require an edited config file, but maybe I'm wrong about that.)
- It can be permanent and affect just the current major mode as long as it will not affect anything other than indentation of the cursor. (Again, maybe permanent change options shouldn't be on this list because I do not want to achieve this through config file editing, but maybe there is another way to make permanent changes that I haven't come across yet.)
- It can be temporary and affect all major modes.
- It can be temporary and affect only the current major mode.
- It can be temporary and affect only the current buffer. (I am unclear on whether an option change like this would persist if I then switch the buffer to a different major mode.)
I have found similar questions here but none that quite hit the mark.
- This question is almost the same but missing my caveats, and the only answer says it risks clobbering useful TAB mappings. can TAB behave like M-i?
- This question is different but hits on a great idea, and could even sidestep the useful mapping clobbering issue (if C-q TAB or even M-i could stand-in for TAB for any useful TAB mappings), but it has no answers at all. Translate TAB with C-q TAB
- This question kind of deals with the global risk issue but the only answer looks like a config file edit.
Side note: I am completely baffled by the way the TAB key works in fundamental mode and in text mode. It tries to indent to align with the start of the next word...OK...but it sometimes skips words, and, much worse, successive indentations end up leaving clusters of space characters amongst tab characters (the space characters are completely useless if they come before tab characters, and they make deleting indentation more difficult since there are extraneous characters to delete).