org-transclusion icon indicating copy to clipboard operation
org-transclusion copied to clipboard

Indentation

Open rtrppl opened this issue 3 years ago • 9 comments

Thanks for the response. It does not bother me but org-transclusion also seems to introduce a first-line indentation.

Bildschirmfoto 2022-01-23 um 13 43 08

Originally posted by @rtrppl in https://github.com/nobiot/org-transclusion/issues/126#issuecomment-1019477695

rtrppl avatar Jan 23 '22 13:01 rtrppl

See also this indentation while editing.

Bildschirmfoto 2022-01-23 um 14 42 35

rtrppl avatar Jan 23 '22 13:01 rtrppl

Thanks for opening a new issue; yes, it's easier to have a separate one.

I have to admit the indentation in Org is a hard problem to solve, so please bear with me. So I think the edit function is doing the right thing, isn't it?

What's the value of org-adapt-indentation? I suspect it's not nil in your case. And if so, my guess is customizing it to nil lets the first case remove the first-line indentation. Would you mind trying this, please?

nobiot avatar Jan 23 '22 13:01 nobiot

Thanks for taking the time to look into this. Edit is working fine, there are no issues with the core functionality of org-transclusion. org-adapt-indentation was the right guess, changing it to nil removed all unexpected indentations. I do not remember changing this setting, nor is it in my .emacs - so non-nil might be the standard.

Bildschirmfoto 2022-01-23 um 15 12 41

rtrppl avatar Jan 23 '22 14:01 rtrppl

The only remaining minor issue seems to be that I loose the fringe (indicating transclusion) when I edit.

rtrppl avatar Jan 23 '22 14:01 rtrppl

I do not remember changing this setting, nor is it in my .emacs - so non-nil might be the standard.

It may well be. My guess is that you had it set to t and as you have org-indent-mod on, you had not noticed that indentation was added by Org via org-adapt-indentation (or maybe org-indent-mode deletes the indentation for you).

When Org-transclusion adds a transclusion, it "resets" it to the most canonical syntax and indentation -- it's not exact copy and paste. This is needed for other functions such as filters, etc. as they rely on built-in org-element functions that works on canonical representations.

This image below is when you don't have org-indent-mode but have org-adapt-indentation set to t. In this case, I manually "remove" indentation from the source. I had other users using org-adapt-indentation without org-indent-mode, so I implemented the fix to respect org-adopt-indenation. Screenshot from 2022-01-23 18-50-48

The only remaining minor issue seems to be that I loose the fringe (indicating transclusion) when I edit.

Yeah, it's another conflict between org-transclusion and org-indent-mode. Without it, the fringe won't disappear.

Just as an aside, the first-line indentation is removed for edit as you can see in the image. The reason is that the source has removed it -- in the case of edit, the source and transclusion must be exactly identical -- otherwise, the edit cannot propagate from one to the other. Some filters also get temporarily removed to achieve exact copy-and-paste, rather than the canonical representation...

Screenshot from 2022-01-23 18-50-54

This is a hard problem for me to solve for me, so I am afraid it won't be quick to fix. As it does not break the data, I have been putting it on back-burner.

nobiot avatar Jan 23 '22 18:01 nobiot

Allow me to keep this issue open. I may be able to come back to it (but not soon).

nobiot avatar Jan 23 '22 18:01 nobiot

Hi, I experience also a conflict between the org-indent-mode and the appearance of the fringe. I use vanilla emacs. Once I disable org-indent-mode, I kill the buffer, re-open it so that I can see the fringe again. But I realized that I can do away with the org-indent-mode by having this line in the config of org package (setq org-adapt-indentation t). I can still see workable indentation going on without the org-indent-mode. This way I can retain both the fringe and indentation of org files. I don't know thought what I would be missing by turning off the org-indent-mode. Anyway, org-transclusion is a great package that deserves some modes to sacrifice.

Emacs: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-02-27

  • Framework: vanilla emacs
  • Org: Org mode version 9.6.1

ffsammak avatar Mar 06 '23 09:03 ffsammak

@nobiot Is there a way to make org-indent-mode work with org-transclusion? I do not want to use real whitespace characters to indent my headings.

BTW, why is the source material getting the fringe marker and not the "transcluded" part? The source material is just normal text and doesn't need a marker, while the read-only transclusion is weird and needs some marker.

NightMachinery avatar Oct 26 '23 16:10 NightMachinery

@NightMachinery, have you had a chance to try org-transclusion-indent-mode? https://nobiot.github.io/org-transclusion/#Extensions

nobiot avatar Oct 29 '23 08:10 nobiot