emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] bug#21818: 24.5; org-set-tags-to indentation problems when calle


From: Nicolas Goaziou
Subject: Re: [O] bug#21818: 24.5; org-set-tags-to indentation problems when called programmatically
Date: Fri, 20 Nov 2015 14:19:31 +0100

Emanuel Evans <address@hidden> writes:

> Nicolas Goaziou <address@hidden> writes:
>
>> I don't consider it to be a bug.
>>
>> `org-element-interpret-data' produces a string, which is expected to be
>> syntactically correct, but doesn't guarantee aesthetics. In particular,
>> `org-element-headline-interpreter' tries to align tags as accurately as
>> possible, but, in this case, fails to succeed as it would require to
>> introduce fontification in the process. This is out of the scope of the
>> function.
>
> Hmmm, that doesn't really make sense to me. Shouldn't the flow of
>
> 1. Edit a document with org-mode
> 2. (org-element-interpret-data (org-element-parse-buffer))
>
> be as close to the original as possible?

It is already as close to the original as reasonable.

The guarantee is that it is syntactically equivalent to the original.
Yet, some information is lost in the process. For example, global
indentation is not meaningful syntax-wise and not retained in the parse
tree. That information is lost. Case (for blocks, properties...) is
another example. As you noticed, the same goes for tags' column, under
some circumstances.

> Seems like the fontification aspect is just an implementation detail.
> In any case, I looked more into the code and would be happy to submit
> a patch to change it if it makes sense to you.

The problem is that the change has a cost. Basically, you need to create
a new buffer, switch to Org mode, copy local variables from the original
buffer, insert the headline and align the tags properly according to the
current fontification rules.

OTOH, all you need to from the caller is to re-align the tags after
insertion.

I suggest to do the latter.


Regards,



reply via email to

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