Skip to content

Indentation in :src blocks and live editing #297

Description

@AndreasMatthias

I'd like to transclude file x.el:

(defun test ()
 (message "222")
 (message "333"))

Note that the function body is indented by 1 space, not 2!

When I transclude this file with

#+transclude: [[./x.el]]  :src emacs-lisp

I get

#+begin_src emacs-lisp
(defun test ()
  (message "222")
  (message "333"))
#+end_src

Note that the function body is now indented by 2 spaces. Probably because I've set list-body-indent to 2,
and the code seems to be reindented during transclusion.

This is an issue, because now the length of the code in tc and src differs, and thus does not allow live editing.

Another example with probably the same issue

Let's say that file x.el is correctly indent by 2 spaces:

(defun test ()
  (message "222")
  (message "333"))

Now I transclude this file with

#+transclude: [[./x.el]]  :src emacs-lisp

I start live-editing, add XXX just before (defun ..., and exit live-editing.
But the moment I exit live-editing the tc-buffer gets reindented, but not the src-buffer.
I.e. the src-buffer is:

XXX(defun test ()
  (message "222")
  (message "333"))

while the tc-buffer is:

src emacs-lisp
XXX(defun test ()
     (message "222")
     (message "333"))
#+end_src

Again the length of src and tc contents differs, and prohibits another live-editing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions