emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] Source block indentation does not work properly for yaml-mode


From: Sébastien Miquel
Subject: Re: [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)]
Date: Mon, 19 Jun 2023 15:32:23 +0000


Ihor Radchenko writes:

What about the following approach:

When converting from org-src buffer back to Org,

1. We do not touch the original indentation, except minimal common
    indentation of the whole src code, respecting the src mode value of
    `indent-tabs-mode'.
2. Minimal common indentation is treated according to
    `org-src-preserve-indentation'.
3. `org-src-preserve-indentation', when in effect, will add extra
    indentation of #+begin indentation + `org-src-preserve-indentation',
    now honouring `indent-tabs-mode' in Org buffer.

When converting from Org to org-src buffer,

1. When `org-src-preserve-indentation' is in effect, remove the common
    `org-src-preserve-indentation' + #+begin indentation from the body.

You've mixed up =org-src-preserve-indentation= and
=org-edit-src-content-indentation= so I may misunderstand. But I guess
what you propose amounts to

 1. When =org-src-preserve-indentation= is =t=, do not touch
    indentation one way or the other (same as now).
 2. Otherwise, do what we do now, but for the common indentation in
    the org buffer, use the org value of =indent-tabs-mode=, and for
    the rest of the indentation, use the native value of
    =indent-tabs-mode=. In this case, instead of trying to read this
    value, we might as well just blindly add the common indentation,
    to every non empty line.



... "- Item $abc<point>\n  efg$"
Shouldn't newlines be removed completely before editing the body here?
Just like what we do for inline src blocks. See `org-babel--normalize-body'.

I was not aware of how we treated inline src blocks, but I don't think
so. LaTeX fragments, in particular $$…$$ fragments, can have
significant (for the user) newlines.

May you provide an example?
AFAIK, LaTeX usually treats newlines as whitespace, same with " ".

When I say significant, I don't mean for compilation. When editing an
array of equations for example, one might want to keep one equation
per line in the buffer.


--
Sébastien Miquel



reply via email to

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