Re: [O] Disable indent-tabs-mode in org-src buffers if appropriate

2017-08-06 Thread Nicolas Goaziou
Hello,

Jonas Bernoulli  writes:

> For the most part Org now honors the file-local value of
> `indent-tabs-mode' as set in an Org file.  When that value is `nil' and
> a buffer used to edit a source block from that file contains lines that
> begin with tabs, then those tabs are being replaced with spaces before
> the text is written back into the Org file.
>
> So far so good.  Unfortunately inside the buffer used to edit the source
> block `indent-tabs-mode' is not disabled when appropriate.  That doesn't
> matter that much since it is just a transient buffer, but it is still
> distracting.

I'm not sure it should be changed. Remote editing buffer usually its own
major modes. `indent-tabs-mode' should obey to that mode, not to the one
from the source buffer.

Also, tabs are not always being replaced with spaces before the text is
written back into the Org file, e.g., when indentation is preserved.

Regards,

-- 
Nicolas Goaziou



[O] Disable indent-tabs-mode in org-src buffers if appropriate

2017-07-26 Thread Jonas Bernoulli
Me again,

For the most part Org now honors the file-local value of
`indent-tabs-mode' as set in an Org file.  When that value is `nil' and
a buffer used to edit a source block from that file contains lines that
begin with tabs, then those tabs are being replaced with spaces before
the text is written back into the Org file.

So far so good.  Unfortunately inside the buffer used to edit the source
block `indent-tabs-mode' is not disabled when appropriate.  That doesn't
matter that much since it is just a transient buffer, but it is still
distracting.

I suggest that you fix that by adding the following at the appropriate
place in `org-src--edit-element':

  (when (= source-tab-width 0)
(setq indent-tabs-mode nil))

Thanks,
Jonas