From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Moving footnotes Date: Fri, 30 May 2014 15:35:25 +0200 Message-ID: <87k393tmn6.fsf@gmail.com> References: <87a99zmnkp.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqMxV-00084m-LP for emacs-orgmode@gnu.org; Fri, 30 May 2014 09:35:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqMxQ-0004SQ-7Y for emacs-orgmode@gnu.org; Fri, 30 May 2014 09:34:57 -0400 In-Reply-To: <87a99zmnkp.fsf@bzg.ath.cx> (Bastien's message of "Fri, 30 May 2014 14:57:10 +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: Bastien Cc: Leonard Randall , emacs-orgmode Hello, Bastien 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