emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org, alantyree@gmail.com, tsd@tsdye.com
Subject: Re: [patch, ox] Unnumbered headlines
Date: Tue, 12 Aug 2014 10:58:53 +0200	[thread overview]
Message-ID: <87egwmaxte.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87r40n6nrg.fsf@gmx.us> (rasmus@gmx.us's message of "Mon, 11 Aug 2014 17:37:23 +0200")

Hello,

Rasmus <rasmus@gmx.us> writes:

> True.  Personally, I find them nicer as you can just C-c C-c on your
> headline and write down some keyword that is typically easy to
> remember.  For properties I must rely on C-c C-x p — since the syntax
> is so awkward — and while it may be memorable to me try to explain it
> to co-authors who are not long-time Emacs users.
>
>> Another option is to use properties, e.g. "UNNUMBERED", or "NO_NUMBER"
>> with a non-nil value
>>
>>   * Some headline
>>     :PROPERTIES:
>>     :UNNUMBERED: t
>>     :END:
>>
>> It is harder to notice an unnumbered headline, but it doesn't add cruft
>> to the tag line, and this is far less important than :noexport:. This is
>> not perfect either, but I think the trade-off is honest.
>
> I can see you point, and I think I agree, though I personally much,
> much prefer tags.

Of course, tags are easier to use than properties, hence their
popularity. But they have some limitations, too.

I'm not saying that we must use a property, but this is definitely
something to ponder.

> Of course a utility function could be added (like the beamer minor
> mode) that adds the tag to give you a visual clue while the properties
> are really what matter.

Which would defeat the choice of using a property (i.e. avoid visual
clutter).

>> Another advantage is inheritance is already implemented for node
>> properties (see `org-export-get-node-property').
>
> Interesting.  I did not know.

Actually, it's not an "advantage" per se, since `org-export-get-tags'
does it too.

> The most elegant way would perhaps be to introduce in the output of
> `org-export-get-headline-number' whether a headline is unnumbered, but
> I am not sure how to do this without breaking the expected output of
> the function.
>
> A dirty fix might be add an extra 0 to the beginning of the section
> number list when dealing with unnumbered headings, but it is not so
> nice as the numbers loose their meaning. . .

Also, headline numbers can start with 0:

  ** H0.1
  * H1
  ** H1.1

You could add a 0 at the end instead, or begin with a negative number,
which cannot happen otherwise, but that would be hackish, for sure.

Since "ox-html.el", and possibly other back-ends, rely on
`number-to-string', there not much else to do down this road.

> What I am currently trying to do with ox-html is combining
> `org-export-get-headline-number' (which is always a list of numbers)
> and `org-export-numbered-headline-p' to determine if the ID should
> contain the substring "unnumbered".  Then the first unnumbered section
> would be "sec-unnumbered-1" and so forth.
>
>> The previous snippet from "ox-html.el" would become
>>
>>   (format "<span class=\"section-number-%d\">%d</span> "
>>           level
>>           (org-export-get-headline-id headline info))
>
> What I was experiment with is something like: 
>
> (format "<span class=\"section-number-%s-%d\">%d</span> "
>    (if numberedp "" "unumbered")
>    level)
>
> Do you think it would be better to work on
> `org-export-get-headline-id' and "solve" the issue in that way is a
> better approach than what I describe above?

Roughly, both approaches require the same amount of changes and imply
the same incompatibilities.

Nevertheless, I think it is cleaner for `org-export-get-headline-number'
to return nil when a headline is not numbered and to separate both
intents, i.e, provide a number and a unique internal id.

Anyway, feel free to experiment, there's no hurry.

Thanks for your work.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-08-12  8:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 13:39 [patch, ox] Unnumbered headlines Rasmus
2014-08-08 22:35 ` Alan L Tyree
2014-08-09  1:04 ` [patch, ox] Unnumbered headlines - early test Alan L Tyree
2014-08-09  7:47 ` [patch, ox] Unnumbered headlines Detlef Steuer
2014-08-11 14:18 ` Nicolas Goaziou
2014-08-11 15:37   ` Rasmus
2014-08-12  8:58     ` Nicolas Goaziou [this message]
2014-09-20 16:02       ` Rasmus
2014-09-20 20:34         ` Alan L Tyree
2014-09-21 13:12         ` Nicolas Goaziou
2014-09-21 14:37           ` Rasmus
2014-09-21 19:40             ` Nicolas Goaziou
2014-09-21 20:13               ` Rasmus
2014-09-22 15:53                 ` Nicolas Goaziou
2014-09-23  0:35                   ` Rasmus
2014-09-23  1:10                     ` Thomas S. Dye
2014-09-26  7:51                     ` Nicolas Goaziou
2014-09-26 13:48                       ` Rasmus
2014-09-27  8:19                         ` Nicolas Goaziou
2014-09-30 22:54                       ` Rasmus
2014-10-02  0:35                         ` Rasmus
2014-10-03  7:56                         ` Nicolas Goaziou
2014-10-03  8:49                           ` Sebastien Vauban
2014-10-03 10:26                           ` Rasmus
2014-10-03 20:14                             ` Nicolas Goaziou
2014-10-03 20:31                               ` Rasmus
2014-10-05  8:06                                 ` Nicolas Goaziou

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=87egwmaxte.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=alantyree@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    --cc=tsd@tsdye.com \
    /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).