From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: bug#21818: 24.5; org-set-tags-to indentation problems when called programmatically Date: Thu, 19 Nov 2015 09:36:13 +0100 Message-ID: <87h9kil72a.fsf@nicolasgoaziou.fr> References: <87r3k7prms.fsf@cersei.i-did-not-set--mail-host-address--so-tickle-me> <83h9l3w1di.fsf@gnu.org> <87bnbbvtkm.fsf@emanuel.industries> <83mvuuvm6j.fsf@gnu.org> <87mvutwa8o.fsf@emanuel.industries> <87d1vo277y.fsf@nicolasgoaziou.fr> <87r3k4ofa9.fsf@nicolasgoaziou.fr> <87egfq7fy9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzKfn-0005hE-2f for emacs-orgmode@gnu.org; Thu, 19 Nov 2015 03:34:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzKfj-00005D-Q5 for emacs-orgmode@gnu.org; Thu, 19 Nov 2015 03:34:31 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:41409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzKfj-000050-Jp for emacs-orgmode@gnu.org; Thu, 19 Nov 2015 03:34:27 -0500 In-Reply-To: <87egfq7fy9.fsf@gmail.com> (Emanuel Evans's message of "Sun, 15 Nov 2015 19:58:54 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emanuel Evans Cc: emacs-orgmode@gnu.org 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