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: Thu, 19 Nov 2015 09:36:13 +0100	[thread overview]
Message-ID: <87h9kil72a.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87egfq7fy9.fsf@gmail.com> (Emanuel Evans's message of "Sun, 15 Nov 2015 19:58:54 -0800")

Hello,

Emanuel Evans <mail@emanuel.industries> 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

  reply	other threads:[~2015-11-19  8:34 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 [this message]
2015-11-19 18:39                   ` Emanuel Evans
2015-11-20 13:19                     ` Nicolas Goaziou
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=87h9kil72a.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).