3 ms·
Someone above pointed out that you can remap it for prog-mode which (I think) programming modes derive from so (again, I think) if you remapped it there you wou
by tabemacsthrow 5y ago
Someone above pointed out that you can remap it for prog-mode which (I think) programming modes derive from so (again, I think) if you remapped it there you would cover the programming modes. Then you could add the few other modes that aren't covered. You would define a list of the modes and loop over them in your init.el to remap them.
The other thing you might want to try is to remap the function indent-for-tab-command to insert-tab.
- akkartik 5y agoNo! I've somehow never encountered `tab-always-indent`, according to my detailed past records. It actually looks like `(setq tab-always-indent nil)` should get me pretty close, according to the documentation. "If the value is t (the default), the command normally just indents the current line. If the value is nil, the command indents the current line only if point is at the left margin or in the line’s indentation; otherwise, it inserts a tab character." (https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode_002dSpecific-Indent.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Mo...) Unfortunately this doesn't immediately work as described (Mac OS, GNU Emacs 27.2). When the buffer x.c looks like this (^ showing point): int main(void) { aaa ^ Pressing Tab now does nothing. I wonder if I need to do something to add this to c-major-mode. I also don't yet understand `setq-default`.
- tabemacsthrow 5y agoIn the docs it says that (for some reason) C has its own separate variable c-tab-always-indent. Also, does M-i (tab-to-tab-stop) do what you want?
- akkartik 5y agoAh, yes, this ([c-]tab-always-indent) seems to work. On both my machines. I'm slightly leery of declaring victory, but this might do the trick for me. I think the major reason I care about this so much (I don't have any unique-snowflake indentation approach) is being able to indent prose inside comments. This approach would buy me that. Let me run with it and see how it goes. Thanks again.
- deleted 5y ago[deleted]
- tabemacsthrow 5y agoWe've hit comment depth limit, but check out M-i (tab-to-tab-stop), other people seem to declare that that is the solution for them (and they rebind it to tab per mode).
- akkartik 5y agoThanks! I'll do that. I plan to carefully try each of the solutions mentioned in this thread. (FYI, you can always get around the comment reply timer (I don't think it's a depth limit) by clicking on a comment's permalink (timestamp).)