summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-08-16 21:43:23 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-08-16 23:20:33 +0200
commita8d621c3da3888281f9ceb1ed95ec45122172499 (patch)
treeee81365311e9899155f1c87fe837220c3e76a25c
parentbaf7dde28ef8730c558a6cf3c789d7400dbc51c6 (diff)
downloadorg-mode-a8d621c3da3888281f9ceb1ed95ec45122172499.tar.gz
org-footnote: remove every footnote tag when normalizing non Org buffers
* lisp/org-footnote.el (org-footnote-normalize): effectively remove any footnote tag in non Org buffers, as detailled in org-footnote-tag-for-non-org-mode-files doc-string.
-rw-r--r--lisp/org-footnote.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index a23e1be..9e97822 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -709,13 +709,14 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
(unless (bolp) (newline))
(setq ins-point (point))))
(t
- (when (and (not (equal org-footnote-tag-for-non-org-mode-files ""))
- (re-search-forward
- (concat "^" (regexp-quote
- org-footnote-tag-for-non-org-mode-files)
- "[ \t]*$")
- nil t))
- (replace-match ""))
+ ;; Remove any left-over tag in the buffer, if one is set up.
+ (when org-footnote-tag-for-non-org-mode-files
+ (let ((tag (concat "^" (regexp-quote
+ org-footnote-tag-for-non-org-mode-files)
+ "[ \t]*$")))
+ (while (re-search-forward tag nil t)
+ (replace-match "")
+ (delete-region (point) (progn (forward-line) (point))))))
;; In Message mode, ensure footnotes are inserted before the
;; signature.
(let ((pt-max (if (and (derived-mode-p 'message-mode)