emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Brent Goodrick <bgoodr@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: 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	[thread overview]
Message-ID: <87h919zc40.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAJj=8EFkL9=QXGf3AdD8FUM=yK4_4p_ZHB-Bp2q5qq0-ELZWow@mail.gmail.com> (Brent Goodrick's message of "Sat, 22 Apr 2017 20:21:07 -0700")

Hello,

Brent Goodrick <bgoodr@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

  reply	other threads:[~2017-04-27 23:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  4:15 org-src--contents-for-write-back : preserve original major-mode, and avoid mixing tabs and spaces in org-mode buffers Brent Goodrick
2017-04-22  8:41 ` Nicolas Goaziou
2017-04-23  3:21   ` Brent Goodrick
2017-04-27 23:04     ` Nicolas Goaziou [this message]
2017-04-28 15:29       ` Brent Goodrick
2017-04-29  9:59         ` Nicolas Goaziou
2017-04-29 16:41           ` Brent Goodrick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h919zc40.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=bgoodr@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).