emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Leonard Randall <leonard.a.randall@gmail.com>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Moving footnotes
Date: Fri, 30 May 2014 15:35:25 +0200	[thread overview]
Message-ID: <87k393tmn6.fsf@gmail.com> (raw)
In-Reply-To: <87a99zmnkp.fsf@bzg.ath.cx> (Bastien's message of "Fri, 30 May 2014 14:57:10 +0200")

Hello,

Bastien <bzg@gnu.org> 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	other threads:[~2014-05-30 13:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 12:23 Moving footnotes Leonard Randall
2014-05-21 16:39 ` Nicolas Goaziou
2014-05-30 12:57 ` Bastien
2014-05-30 13:35   ` Nicolas Goaziou [this message]
2014-05-30 13:51     ` Bastien
2014-05-31  9:30       ` Nicolas Goaziou
2014-05-31 11:09         ` Bastien
2014-06-01  6:48           ` Nicolas Goaziou
2014-06-01  8:49             ` Bastien
2014-06-02 12:10               ` Leonard Avery Randall

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=87k393tmn6.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=leonard.a.randall@gmail.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).