emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-export-section-number-format does not work
@ 2013-07-07 19:40 Jisang Yoo
  2013-07-08  8:05 ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Jisang Yoo @ 2013-07-07 19:40 UTC (permalink / raw)
  To: emacs-orgmode

Org-mode version 8.0.5 (latest)



Test done with this command:

emacs -q --load ~/t/org-test-final.el



Contents of ~/t/org-test-final.el:

(setq package-load-list '((org t)
                          (org-plus-contrib t)))
(setq org-export-section-number-format '((("I" ".")) . "."))
(package-initialize)
(find-file "~/t/simple.org")



Contents of ~/t/simple.org:

* one
** two
*** three



In the test emacs session, press C-c C-e (org-export-dispatch) then
press h o to open the exported html in the browser. The section
numbers are shown as 1 and 1.1 and 1.1.1 when they should be, I guess,
I. and I.I. and I.I.I.

Same result with this too:

(setq package-load-list '((org t)))
(custom-set-variables
 '(org-export-section-number-format (quote ((("1" ".")) . "."))))
(package-initialize)
(find-file "~/t/simple.org")

C-h v cannot find the variable org-export-section-number-format but
M-x customize-group RET org-export-general RET shows its
documentation, after that C-h v shows it is defined in org-exp.el
which is a file bundled with Emacs, and is not part of the latest org
package.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-07 19:40 org-export-section-number-format does not work Jisang Yoo
@ 2013-07-08  8:05 ` Bastien
  2013-07-08  8:19   ` Jisang Yoo
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-07-08  8:05 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: emacs-orgmode

Hi Jisang,

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> C-h v cannot find the variable org-export-section-number-format but
> M-x customize-group RET org-export-general RET shows its
> documentation, after that C-h v shows it is defined in org-exp.el
> which is a file bundled with Emacs, and is not part of the latest org
> package.

Yes, you describe the root of the problem: forget about the variable
`org-export-section-number-format' as it is not part of the version
you are using.  Maybe someone can help pointing to the new option
you need to set.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08  8:05 ` Bastien
@ 2013-07-08  8:19   ` Jisang Yoo
  2013-07-08  8:21     ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Jisang Yoo @ 2013-07-08  8:19 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Mon, Jul 8, 2013 at 5:05 PM, Bastien <bzg@gnu.org> wrote:
> Hi Jisang,
>
> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>
>> C-h v cannot find the variable org-export-section-number-format but
>> M-x customize-group RET org-export-general RET shows its
>> documentation, after that C-h v shows it is defined in org-exp.el
>> which is a file bundled with Emacs, and is not part of the latest org
>> package.
>
> Yes, you describe the root of the problem: forget about the variable
> `org-export-section-number-format' as it is not part of the version
> you are using.  Maybe someone can help pointing to the new option
> you need to set.
>
> --
>  Bastien

There seems no new option that can be found from exploring
customization group org-export.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08  8:19   ` Jisang Yoo
@ 2013-07-08  8:21     ` Bastien
  2013-07-08 19:57       ` Jisang Yoo
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-07-08  8:21 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: emacs-orgmode

Hi Jisang,

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> There seems no new option that can be found from exploring
> customization group org-export.

You can check `org-html-format-headline-function' and its docstring
as an example on how to customize the display of headlines in HTML.
There are similar variables for other backends.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08  8:21     ` Bastien
@ 2013-07-08 19:57       ` Jisang Yoo
  2013-07-08 20:31         ` Bastien
                           ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jisang Yoo @ 2013-07-08 19:57 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Mon, Jul 8, 2013 at 5:21 PM, Bastien <bzg@gnu.org> wrote:
> Hi Jisang,
>
> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>
>> There seems no new option that can be found from exploring
>> customization group org-export.
>
> You can check `org-html-format-headline-function' and its docstring
> as an example on how to customize the display of headlines in HTML.
> There are similar variables for other backends.
>
> HTH,
>
> --
>  Bastien

(setq org-html-format-headline-function 'my-org-html-format-headline)
(defun my-org-html-format-headline (todo todo-type priority text tags)
  "Returns foo."
  "foo")

results in wrong-number-of-arguments error when I export to html.

(setq org-html-format-headline-function 'org-html-format-headline)

also results in the same kind of error.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08 19:57       ` Jisang Yoo
@ 2013-07-08 20:31         ` Bastien
  2013-07-08 20:35         ` Nicolas Goaziou
  2013-07-09  4:22         ` Nick Dokos
  2 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2013-07-08 20:31 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: emacs-orgmode

Hi Jisang,

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> (setq org-html-format-headline-function 'my-org-html-format-headline)
> (defun my-org-html-format-headline (todo todo-type priority text tags)
>   "Returns foo."
>   "foo")
>
> results in wrong-number-of-arguments error when I export to html.
>
> (setq org-html-format-headline-function 'org-html-format-headline)
>
> also results in the same kind of error.

I confirm this bug.  The code is too convoluted here, I hope someone
will have the patience to fix this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08 19:57       ` Jisang Yoo
  2013-07-08 20:31         ` Bastien
@ 2013-07-08 20:35         ` Nicolas Goaziou
  2013-08-24  6:55           ` Jisang Yoo
  2013-07-09  4:22         ` Nick Dokos
  2 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-07-08 20:35 UTC (permalink / raw)
  To: Jisang Yoo; +Cc: Bastien, emacs-orgmode

Hello,

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> (setq org-html-format-headline-function 'my-org-html-format-headline)
> (defun my-org-html-format-headline (todo todo-type priority text tags)
>   "Returns foo."
>   "foo")
>
> results in wrong-number-of-arguments error when I export to html.
>
> (setq org-html-format-headline-function 'org-html-format-headline)
>
> also results in the same kind of error.

Indeed. This should be fixed. Thank you.

BTW, this function will only give you control over headline text, not
its numbering.

Using a filter (see org-export-filter-headline-functions) should allow
you to set numbering to roman (e.g., with `org-export-number-to-roman'
function).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08 19:57       ` Jisang Yoo
  2013-07-08 20:31         ` Bastien
  2013-07-08 20:35         ` Nicolas Goaziou
@ 2013-07-09  4:22         ` Nick Dokos
  2013-07-09 11:15           ` Bastien
  2 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2013-07-09  4:22 UTC (permalink / raw)
  To: emacs-orgmode

Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:

> On Mon, Jul 8, 2013 at 5:21 PM, Bastien <bzg@gnu.org> wrote:
>> Hi Jisang,
>>
>> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>>
>>> There seems no new option that can be found from exploring
>>> customization group org-export.
>>
>> You can check `org-html-format-headline-function' and its docstring
>> as an example on how to customize the display of headlines in HTML.
>> There are similar variables for other backends.
>>
>> HTH,
>>
>> --
>>  Bastien
>
> (setq org-html-format-headline-function 'my-org-html-format-headline)
> (defun my-org-html-format-headline (todo todo-type priority text tags)
>   "Returns foo."
>   "foo")
>
> results in wrong-number-of-arguments error when I export to html.
>
> (setq org-html-format-headline-function 'org-html-format-headline)
>
> also results in the same kind of error.
>
>

I think all that's needed is to add an explicit nil at the end of the
apply call in ox-html.el:org-html-format-headline--wrap, line 2246, like
this:

--8<---------------cut here---------------start------------->8---
    ...
    (apply format-function
	   todo todo-type  priority text tags
	   :headline-label headline-label :level level
	   :section-number section-number extra-keys nil)))
--8<---------------cut here---------------end--------------->8---

I'm not 100% sure about that but it seems to work for me both in the
default case and also with Jisang's setting - can somebody verify?

But getting there was not trivial: the CL-isms certainly do not help,
primarily because I had to understand them to figure out what was going
on, but also because they obscured the problem: when I tried to edebug
org-html-format-headline--wrap I get

,----
| edebug-syntax-error: Invalid read syntax: "Failed matching", ([&rest
| arg] [&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]]
| [&optional ["&rest" arg]] [&optional ["&key" [cl-&key-arg &rest
| cl-&key-arg] &optional "&allow-other-keys"]] [&optional ["&aux" &rest
| &or (symbolp &optional def-form) symbolp]])
`----

and the cursor is left at the ampersand of &allow-other-keys. OTOH,
when I try to edebug org-html-inlinetask which contains a similar
CL-ism, there is no problem. So something is tripping edebug up
but it's not clear what.

-- 
Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-09  4:22         ` Nick Dokos
@ 2013-07-09 11:15           ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2013-07-09 11:15 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi,

Nick Dokos <ndokos@gmail.com> writes:

> But getting there was not trivial: the CL-isms certainly do not help,
> primarily because I had to understand them to figure out what was going
> on, but also because they obscured the problem: when I tried to edebug
> org-html-format-headline--wrap I get

I suggest to get rid of defun* and function* in ox-html.el, this is
unnecessary and complex to read/debug, as you say.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: org-export-section-number-format does not work
  2013-07-08 20:35         ` Nicolas Goaziou
@ 2013-08-24  6:55           ` Jisang Yoo
  0 siblings, 0 replies; 10+ messages in thread
From: Jisang Yoo @ 2013-08-24  6:55 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode

On Tue, Jul 9, 2013 at 5:35 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
>
> Hello,
>
> Jisang Yoo <jisang.yoo.ac+org@gmail.com> writes:
>
> > (setq org-html-format-headline-function 'my-org-html-format-headline)
> > (defun my-org-html-format-headline (todo todo-type priority text tags)
> >   "Returns foo."
> >   "foo")
> >
> > results in wrong-number-of-arguments error when I export to html.
> >
> > (setq org-html-format-headline-function 'org-html-format-headline)
> >
> > also results in the same kind of error.
>
> Indeed. This should be fixed. Thank you.
>
> BTW, this function will only give you control over headline text, not
> its numbering.
>
> Using a filter (see org-export-filter-headline-functions) should allow
> you to set numbering to roman (e.g., with `org-export-number-to-roman'
> function).
>
>
> Regards,
>
> --
> Nicolas Goaziou


For those wondering the same, I figured out how to use
org-export-filter-headline-functions to do what I want

http://yoo2080.wordpress.com/2013/08/24/changing-the-number-format-for-section-headings-in-org-mode-html-export/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-24  6:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-07 19:40 org-export-section-number-format does not work Jisang Yoo
2013-07-08  8:05 ` Bastien
2013-07-08  8:19   ` Jisang Yoo
2013-07-08  8:21     ` Bastien
2013-07-08 19:57       ` Jisang Yoo
2013-07-08 20:31         ` Bastien
2013-07-08 20:35         ` Nicolas Goaziou
2013-08-24  6:55           ` Jisang Yoo
2013-07-09  4:22         ` Nick Dokos
2013-07-09 11:15           ` Bastien

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).