From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch, ox] Unnumbered headlines Date: Tue, 12 Aug 2014 10:58:53 +0200 Message-ID: <87egwmaxte.fsf@nicolasgoaziou.fr> References: <87lhqzyubg.fsf@gmx.us> <87bnrrp0tb.fsf@nicolasgoaziou.fr> <87r40n6nrg.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH7uO-0004pX-3H for emacs-orgmode@gnu.org; Tue, 12 Aug 2014 04:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XH7uG-000697-0a for emacs-orgmode@gnu.org; Tue, 12 Aug 2014 04:58:20 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:45927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH7uF-00068k-OB for emacs-orgmode@gnu.org; Tue, 12 Aug 2014 04:58:11 -0400 In-Reply-To: <87r40n6nrg.fsf@gmx.us> (rasmus@gmx.us's message of "Mon, 11 Aug 2014 17:37:23 +0200") 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: Rasmus Cc: emacs-orgmode@gnu.org, alantyree@gmail.com, tsd@tsdye.com Hello, Rasmus 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 =E2=80=94 since the sy= ntax > is so awkward =E2=80=94 and while it may be memorable to me try to explai= n 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 "%d " >> level >> (org-export-get-headline-id headline info)) > > What I was experiment with is something like:=20 > > (format "%d " > (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, --=20 Nicolas Goaziou