Subject: Footnotes: only allow creation when in text body [Code included]

From: Boruch Baum <[email-masked]>
Date: Thu, 20 Jul 2017 17:40:02 -0400

I'm experiencing a bug in that emacs is allowing me to add a footnote
when I am already in the footnote region. In that case, emacs blithely
adds a footnote text marker at point within the footnote region. Of
course, it also then adds a footnote reference marker.

Here's my fix, for your consideration.

#+BEGIN_SRC emacs-lisp
(defadvice Footnote-add-footnote (around abort-when-in-fn-area activate)
  (interactive)
  (if (or
        (not footnote-text-marker-alist)
        (< (point) (cdr (first footnote-text-marker-alist))))
    ad-do-it
   (message "Add footnotes only while in text body")))
#+END_SRC

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0