emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Moving footnotes


From: Nicolas Goaziou
Subject: Re: [O] Moving footnotes
Date: Fri, 30 May 2014 15:35:25 +0200

Hello,

Bastien <address@hidden> writes:

> from the master branch, you can now use
> `org-footnote-inline-footnotes' to convert external footnotes into
> inline ones.

You didn't ask for it, but here are a few comments about it anyway ;)

 (concat org-footnote-re "\\]")

will fail for numbered footnotes, since the regexp already contains the
closing bracket for this case. I suggest to use:

  (while (re-search-forward org-footnote-re nil t)
    (let ((context (save-excursion (backward-char) (org-element-context))))
      (when (and (eq (org-element-type context) 'footnote-reference)
                 (eq (org-element-property :type context) 'standard))
        ...)))

Also, as a rule of thumb,

 (car (org-element-at-point)) => (org-element-type (org-element-at-point))

Indeed, `car' relies on the internal representation of the object, which
might change. Public interface is less likely to do so.

You don't need to use `org-forward-element' since you called
`org-element-at-point', which will give you all the information needed,
which is probably (org-element-property :end element).

You should check if `org-footnote-section' is not nil before trying to
remove it.

Eventually, you should note that this process is bound to fail in some
situations, as footnote definitions can contain way more objects than
inline ones (e.g., lists, tables, multiple paragraphs ...). Worse, it
will break the current document when attempting to do so since footnote
definitions can contain blank lines.

All in all, I'm not convinced this should be a function provided in Org.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]