* lisp/org-footnote.el (org-footnote-in-valid-context-p): avoid cited
lines and headers in message-mode.
(org-footnote-at-reference-p): remove check for cited lines, this is
now handled by the previous function. Refactor.
* lisp/org-footnote.el (org-footnote-at-reference-p): test if match is
in cited text, when replying to a message.
(org-footnote-new): do not create a new footnote at bol, as it might
be seen as a definition.
(org-footnote-at-definition-p): ignore definitions in forbidden
blocks, as it is already the case for references.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* lisp/org-exp.el (org-export-preprocess-string): add the possibility
to call recursively the function. Also change order of some function
calls. Comment export process for footnotes.
* lisp/org-footnote.el (org-footnote-normalize): change the export
specific parameter to hold properties of export. Thus, the function
can send every footnote definition in the buffer through
`org-export-process-string'.
* lisp/org.el (org-in-block-p): new function.
* lisp/org-footnote.el (org-footnote-forbidden-blocks): new variable.
(org-footnote-in-valid-context-p): new function.
(org-footnote-at-reference-p): use new function. Allow inline
footnotes to start at bol.
* lisp/org-footnote.el (org-footnote-at-reference-p): verify that what
looks like a footnote doesn't belong to a link.
(org-footnote-next-reference-or-definition): check more strictly
footnote definitions.
* lisp/org-footnote.el (org-footnote-at-reference-p): first check if
point is at the beginning of a footnote. Indeed `org-in-regexp'
first checks backwards and might find an incorrect footnote if they
are side-by-side.
* lisp/org-footnote.el (org-footnote-re): avoid matching inactive
time-stamps or check-box cookies.
(org-footnote-next-reference-or-definition): adapt to the new regexp.
* lisp/org-footnote.el (org-footnote-normalize): add `org-footnote'
property to footnote markers when preparing for exportation.
* lisp/org-html.el (org-export-as-html): read new property to decide
when to export a footnote.
* lisp/org-docbook.el (org-export-as-docbook): read new property to
decide when to export a footnote.
* lisp/org-latex.el (org-export-latex-preprocess): ensure footnote at
column 0 cannot end a list containing it by adding
`original-indentation' property to it.
* lisp/org-exp.el (org-export-footnotes-markers,
org-export-footnotes-data): new variables.
(org-export-preprocess-string): use a more explicit argument.
* lisp/org-html.el (org-export-as-html): initialize new variables.
* lisp/org-docbook.el (org-export-as-docbook): initialize new variables.
* lisp/org-latex.el (org-export-latex-footmark-seen): new variable.
(org-export-as-latex): initialize new variables.
(org-export-latex-preprocess): allow to export two or more footnotes
in a row. Also permit to have footnotes refering to previously
defined footnotes.
* lisp/org-ascii.el (org-export-as-ascii): feed org-footnote-normalize
with data so it can normalize footnotes before first headline, or
footnotes with their definition outside exported region.
* lisp/org-footnote.el (org-footnote-goto-definition): now,
determining if point is at a footnote reference is entirely
determined by `org-footnote-at-reference-p'. No need to check if
pattern isn't at beginning of the line elsewhere.
* lisp/org-footnote.el (org-footnote-next-reference-or-definition):
new function.
* lisp/org.el (org-activate-footnote-links): activate the whole
footnote, but only fontify its label.
* lisp/org-footnote.el (org-footnote-normalize): make use of changes
to `org-footnote-at-reference-p' and creation of various functions..
Also comment code.
(org-footnote-get-next-reference, org-footnote-delete-references,
org-footnote-delete-definitions): new functions
(org-footnote-goto-previous-reference, org-footnote-all-labels,
org-insert-footnote-reference-near-definition, org-footnote-delete):
rewrite to use org-footnote-get-next-reference.
* lisp/org-footnote.el (org-footnote-re): don't end an inline footnote
at unrelated closing square brackets.
(org-footnote-at-reference-p): improve accuracy of the function to
determine if point is at a reference and to extract definition of an
inline footnote.
(org-footnote-all-labels, org-footnote-action, org-footnote-delete,
org-footnote-auto-adjust-maybe): make use of previous function.
PATCH-5/5 org-odt compatibility patch
From 22c4feee78ff9a1ab7cc48275ec29d322a3472a1 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
Date: Thu, 23 Jun 2011 13:17:18 +0530
Subject: [PATCH 5/5] Control insertion point for footnote definitions during pre-process.
* lisp/org-footnote.el
(org-footnote-insert-pos-for-preprocessor): New variable.
(org-footnote-normalize): Use it.
* lisp/org-footnote.el: (org-footnote-auto-label): New random option
* lisp/org-footnote.el: (org-footnote-new): Create random footnote
labels with unique ids
* lisp/org-footnote.el: (org-footnote-create-definition): Allow for
footnote sections above the current footnote insertion point.
Fixes bug in which org-mode will create a new footnote section if the
current footnote section is not beneath the current insertion point.
* lisp/org-footnote.el: (org-footnote-create-definition): Don't search
for last footnote when in org-mode file.
The recent changes to accommodate signatures in message-mode instruct
org-mode to search for the last footnote in the entire buffer when
inserting a new footnote definition. This causes problems in org
buffers, since org-footnote-goto-local-insertion-point already finds
the correct insertion point. (I.e., the insertion point is always
placed in beneath the last footnote in the buffer, even if
org-footnote-section is nil.) This patch invokes the search only if in
non org-mode buffers.
* org-footnote.el (org-footnote-create-definition): Place Footnotes
section before message-signature-separator also in modes derived
from message-mode.
* lisp/org-footnote.el (org-footnote-create-definition)
(org-footnote-goto-local-insertion-point): Add footnotes before
signature when in message-mode.
Scot Beker writes:
> I cite my references in org like
> this.\autocite[231]{bibtexkey_2009}, where '231' is the
> relevant page number. When exporting to LaTeX, Org thinks
> that the value in square brackets is a footnote number and
> produces a document with a "footnote definition not found:
> 231" error message at the bottom of the document. My
> settings are below, and I've searched pretty hard through
> them to look for anything that might have caused it. Any
> ideas?
Matt Lundin writes:
> I have org-footnote-section set to "Footnotes." If I insert a new
> footnote while...
>
> 1. the "* Footnotes" tree already exists and
>
> 2. the "* Footnotes" tree is folded
>
> ...the footnote definition label is inserted, but the "* Footnotes"
> subtree remains folded and the cursor jumps to the "* Footnotes"
> headline rather than the definition line.
>
> I've tried using org-reveal (C-c C-r) to open the "Footnotes" section,
> but nothing happens. I've tried typing C-c C-c to go back to the
> footnote, but since the cursor is on a headline, the result is a tag
> prompt. When I hit TAB to cycle, the cursor remains on the headline.
Nick Dokos writes:
> I define a LaTeX macro at the top of my document, like so:
>
> ,----
> | ...
> | #+LATEX_HEADER: \newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
> | #+LATEX_HEADER: #1\ignorespaces
> | #+LATEX_HEADER: }
> | ...
> `----
>
> and export - I get the following inserted:
>
> ,----
> | ...
> | \begin{document}
> |
> |
> |
> |
> |
> | \$\^{}{1}\$ FOOTNOTE DEFINITION NOT FOUND: 1
> | ...
> `----
>
> Obviously, the macro argument spec is mistaken for a footnote.
Customize the new variable org-footnote-auto-adjust or use the STARTUP
option fnadjust to get automatic renumbering and sorting of footnotes
after each insertion/deletion.
This commit adds a new action to the footnote actions:
It allows to renumber footnote marks that have the simple form
fn:N where N is a number. After this action, numbers will start from
1 and increase through the document.
With the "* Footnotes" heading as last line in the buffer, footnote
insertion did not position new definitions correctly. This commit
fixes the problem.
Reported by Matt Lundin.
Sorting footnotes used to be almost like normalization, in that all
footnotes would be collected into a single location. Now sorting
respects the setting of `org-footnote-section'. If that is nil,
sorting will actually move each footnote into the outline node of its
first reference.
This commit add a new face for footnote labels, and activates footnote
labels for mouse clicks and for `C-c C-o', to jump to the
corresponding reference or definition.
This patch implements fully automatic creation of unique labels for
footnotes, which is also turned on as the default setting. The
automatic labels look like [fn:1], [fn:2], etc, using the first
available unused number.
The commit introduces a new variable, `org-footnote-auto-label' with a
number of different options ranging from no auto creation (prompting
the user for a label) to fully automatic creation.
Also, the commit introduces new #+STARTUP options that can be used to
select these settings on a per-file basis.
There was a bug with documents with more than one anonymous footnotes,
which would all end up to reference the first one only. The patch
fixes this problem.
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".