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

2017-12-03 Thread Nicolas Goaziou
Nicolas Goaziou  writes:

> Nicolas Goaziou  writes:
>
>> After a quick glance, I think you are right: invisible characters are
>> not treated the same way in both cases. I'll investigate deeper soon.
>
> Fixed in d5767ad.

Closing this bug report, since my past self apparently fixed it.

Regards,





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

2015-11-20 Thread Nicolas Goaziou
Emanuel Evans  writes:

> Nicolas Goaziou  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,



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

2015-11-19 Thread Nicolas Goaziou
Hello,

Emanuel Evans  writes:

> Hi! It looks like it's fixed for `org-insert-link', but I ran across a
> similar bug with `org-element-interpret-data' that seems to be not
> entirely fixed:
>
> (defun good-indent ()
>   (interactive)
>   (insert (org-element-interpret-data
>`(headline (:level 1
>   :title "something"
>   :tags ("foo"))
>
> (defun bad-indent ()
>   (interactive)
>   (insert (org-element-interpret-data
>`(headline (:level 1
>   :title ((link (:raw-link 
> "http://www.example.com/foo/bar/baz/qux/abc123f56789;)
> "something"))
>   :tags ("foo"))
>
> `good-indent' looks like:
>
> * something :foo:
>
> With org-mode 8.2.10, `bad-indent' looks like:
>
> * something:foo:
>
> With the latest master version of org-mode (d6aafd7), `bad-indent' looks
> like:
>
> * something  :foo:
>
> (i.e., "almost but still not quite right").
>
> I'm not very familiar with the org-element internals, but is there any
> way to work around this for 8.2.10? (I'm writing a library that I'd like
> to be compatible with Emacs 24.5.)

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.

I think it is the duty of the caller, here `bad-indent', to align the
tags properly.


Regards,

-- 
Nicolas Goaziou



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

2015-11-19 Thread Emanuel Evans
Nicolas Goaziou  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? 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.

- Emanuel




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

2015-11-05 Thread Nicolas Goaziou
Hello,

Emanuel Evans  writes:

> Great, is there anything else I should do from my end to make sure it
> gets to the org mailing list? (I looked for the original post there and
> didn't see it.)

You report reached the Org mailing list. Thank you.

After a quick glance, I think you are right: invisible characters are
not treated the same way in both cases. I'll investigate deeper soon.

Regards,

-- 
Nicolas Goaziou





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

2015-11-05 Thread Nicolas Goaziou
Nicolas Goaziou  writes:

> After a quick glance, I think you are right: invisible characters are
> not treated the same way in both cases. I'll investigate deeper soon.

Fixed in d5767ad.





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

2015-11-05 Thread Emanuel Evans
Nicolas Goaziou  writes:

> Fixed in d5767ad.

Awesome, thanks for looking at this!




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

2015-11-05 Thread Emanuel Evans
Glenn Morris  writes:

> Nope, just a mailing list AFAIK. Assigning something to the debbugs
> org-mode package (which I already did for this report) sends stuff there.

Great, is there anything else I should do from my end to make sure it
gets to the org mailing list? (I looked for the original post there and
didn't see it.)






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

2015-11-05 Thread Emanuel Evans
Eli Zaretskii  writes:

> Org mode has its own bug tracker, AFAIR.

OK, I'll submit there. Thanks!

> P.S. Your email bounces, so sending me a private email is not very
> wise...

Oops, sorry about that and thanks for the heads up.






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

2015-11-04 Thread Emanuel Evans
Apologies if this is a dupe; I think some of my posts aren't getting
through to the list (I just subscribed, so hopefully that will help).

Glenn Morris  writes:

> Nope, just a mailing list AFAIK. Assigning something to the debbugs
> org-mode package (which I already did for this report) sends stuff there.

Great, is there anything else I should do from my end to make sure it
gets to the org mailing list? (I looked for the original post there and
didn't see it.)






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

2015-11-04 Thread Emanuel Evans
Apologies if this is a dupe; I think some of my posts aren't getting
through to the list (I just subscribed, so hopefully that will help).

Glenn Morris  writes:

> Nope, just a mailing list AFAIK. Assigning something to the debbugs
> org-mode package (which I already did for this report) sends stuff there.

Great, is there anything else I should do from my end to make sure it
gets to the org mailing list? (I looked for the original post there and
didn't see it.)





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

2015-11-04 Thread Glenn Morris
Eli Zaretskii wrote:

> Org mode has its own bug tracker, AFAIR.

Nope, just a mailing list AFAIK. Assigning something to the debbugs
org-mode package (which I already did for this report) sends stuff there.





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

2015-11-03 Thread Eli Zaretskii
> From: Emanuel Evans 
> Date: Tue, 03 Nov 2015 10:14:33 -0800
> 
> Eli Zaretskii  writes:
> 
> > Are you sure this isn't a problem with Org mode?  If not, can you tell
> > why you think so?
> 
> Oh, I think it could definitely be a problem with Org mode, I just
> thought this would be the right place to file a bug because it's a
> built-in package. Is there a better place to send a report?

Org mode has its own bug tracker, AFAIR.

> (I also think it's possible that it's a lower-level bug because
> `current-column' is changing behavior when using edebug, which seems
> like a bug either in `current-column' or edebug.)

If the Org developers say it's a core bug, please come back here (or
they should), with data that shows how to reproduce the problem,
ideally without Org at all.

Thanks.

P.S. Your email bounces, so sending me a private email is not very
wise...