emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Emanuel Evans <mail@emanuel.industries>
Cc: emacs-orgmode@gnu.org
Subject: Re: bug#21818: 24.5; org-set-tags-to indentation problems when called programmatically
Date: Fri, 20 Nov 2015 14:19:31 +0100	[thread overview]
Message-ID: <87ziy8kduk.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <874mghrfz4.fsf@emanuel.industries> (Emanuel Evans's message of "Thu, 19 Nov 2015 10:39:27 -0800")

Emanuel Evans <mail@emanuel.industries> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> 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	other threads:[~2015-11-20 13:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r3k7prms.fsf@cersei.i-did-not-set--mail-host-address--so-tickle-me>
     [not found] ` <83h9l3w1di.fsf@gnu.org>
     [not found]   ` <87bnbbvtkm.fsf@emanuel.industries>
2015-11-03 20:54     ` bug#21818: 24.5; org-set-tags-to indentation problems when called programmatically Eli Zaretskii
2015-11-04 17:36       ` Glenn Morris
     [not found]       ` <r5d1vpacpz.fsf__49905.2603183829$1446658685$gmane$org@fencepost.gnu.org>
2015-11-04 18:18         ` Emanuel Evans
2015-11-04 23:01         ` Emanuel Evans
2015-11-05  0:39         ` Emanuel Evans
2015-11-05  8:14           ` Nicolas Goaziou
2015-11-05 11:29             ` Nicolas Goaziou
2015-11-05 17:02               ` Emanuel Evans
2015-11-16  3:58               ` Emanuel Evans
2015-11-19  8:36                 ` Nicolas Goaziou
2015-11-19 18:39                   ` Emanuel Evans
2015-11-20 13:19                     ` Nicolas Goaziou [this message]
2017-12-03 16:24               ` Nicolas Goaziou
     [not found]     ` <83mvuuvm6j.fsf__26874.6292721064$1446584168$gmane$org@gnu.org>
2015-11-03 21:25       ` Emanuel Evans

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=87ziy8kduk.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@emanuel.industries \
    /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).