1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-25 07:27:57 +00:00

Footnotes: Allow notes to be placed into the current entry.

Setting org-footnote-section to nil now causes definitions to be
inserted at the end of the current outline node, instead of into a
special node names "Footnotes".
This commit is contained in:
Carsten Dominik 2009-01-01 18:01:07 +01:00
parent 9255522b91
commit b956d4077b
2 changed files with 30 additions and 21 deletions

View File

@ -98,7 +98,7 @@ convert them to numbered ones before export. Thanks, Paul!
Literal examples introduced with =#+BEGIN_EXAMPLE= or =#+BEGIN_SRC=
do now allow optional line numbering in the example.
Furthermore, links to specific code lines are supported, greatly
increasing Org-mode utility for writing tutorials and other
increasing Org-mode's utility for writing tutorials and other
similar documents.
Code references use special labels embedded directly into the

View File

@ -62,15 +62,17 @@
(defcustom org-footnote-section "Footnotes"
"Outline heading containing footnote definitions before export.
During editing, Org-mode places footnote definitions under this
special outline heading. You can have several such sections in a buffer,
Org-mode will always use the nearest. So, for example, each top-level
heading could have its own level-2 child for footnotes.
This is the heading where Org places the definition automatically. However,
by hand you may place definitions *anywhere*.
During export, all subtrees starting with this heading will be removed."
This can be nil, to place footnotes locally at the end of the current
outline node. If can also be the name of a special outline heading
under which footnotes should be put.
This variable defines the place where Org puts the definition
automatically. However, by hand you may place definitions *anywhere*.
If this is a string, during export, all subtrees starting with this
heading will be removed after extracting footnote definitions."
:group 'org-footnotes
:type 'string)
:type '(choice
(string :tag "Special outline node name")
(const :tag "Define footnotes in the current outline node" nil)))
(defcustom org-footnote-tag-for-non-org-mode-files "Footnotes:"
"Tag marking the beginning of footnote section.
@ -205,12 +207,17 @@ or new, let the user edit the definition of the footnote."
(let (re p)
(cond
((org-mode-p)
(setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
(unless (or (re-search-forward re nil t)
(and (progn (widen) t)
(re-search-forward re nil t)))
(goto-char (point-max))
(insert "\n\n* " org-footnote-section))
(if (not org-footnote-section)
;; No section, put foornote into the curren outline node
nil
;; Try to find or make the special node
(setq re (concat "^\\*+[ \t]+" org-footnote-section "[ \t]*$"))
(unless (or (re-search-forward re nil t)
(and (progn (widen) t)
(re-search-forward re nil t)))
(goto-char (point-max))
(insert "\n\n* " org-footnote-section)))
;; Now go to the end of this entry and insert there.
(outline-next-heading)
(setq p (point))
(skip-chars-backward " \t\n\r")
@ -304,10 +311,11 @@ referenced sequence."
(goto-char (point-min))
(cond
((org-mode-p)
(if (re-search-forward
(concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
"[ \t]*$")
nil t)
(if (and org-footnote-section
(re-search-forward
(concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
"[ \t]*$")
nil t))
(if for-preprocessor
(replace-match "")
(org-back-to-heading t)
@ -316,8 +324,9 @@ referenced sequence."
(delete-region (point) (org-end-of-subtree t)))
(goto-char (point-max))
(unless for-preprocessor
(insert "* " org-footnote-section "\n")
(setq ins-point (point)))))
(when org-footnote-section
(insert "* " org-footnote-section "\n")
(setq ins-point (point))))))
(t
(if (re-search-forward
(concat "^"