Hello, Brent Goodrick <bgo...@gmail.com> writes:
> In the current implementation of org-src--contents-for-write-back, the > `with-temp-buffer` uses fundamental-mode. Correct. > Later, while inside that temp buffer, spaces are inserted in to indent > the entire source block over to where it needs to be (in my original > post, notice that I have the source block within a list item so the > source block needs to be aligned properly under that list item, no > matter to what depth that list item is). Correct. > It is in mode hook functions that certain changes to indentation can > occur, so that is why I'm switching into that mode. This is where I don't follow you. At this point, indentation changes are tailored for the source, i.e., Org, buffer. Special indentation rules from the source block mode do not apply here. > But that is not enough: In order for the text to be aligned properly > inside the org mode buffer after indentation, there cannot be a mix of > tabs and spaces, as shown in my original post. IIRC, `indent-to' is > called within the `write-back' function, and `indent-to' is affected > by the `indent-tabs-mode' value, which by default in emacs lisp mode > buffers, is t. You cannot set `indent-tabs-mode' to nil and discard user's configuration. What if I want it to be non-nil in Org buffers? Another option is to delete any leading indentation and indent it again according to `indent-tabs-mode' value in source buffer. WDYT? Regards, -- Nicolas Goaziou