emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-src--contents-for-write-back : preserve original major-mode,


From: Nicolas Goaziou
Subject: Re: [O] org-src--contents-for-write-back : preserve original major-mode, and avoid mixing tabs and spaces in org-mode buffers
Date: Fri, 28 Apr 2017 01:04:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

Brent Goodrick <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]