Additionally, replace one
(or (org-mode-p) (derived-mode-p 'org-mode))
with
(derived-mode-p 'org-mode)
cause that is reflexive anyway (returns true, if the current mode is
org-mode).
Delete one check testing for org-mode or org derived mode
Hi all,
org-footnote-renumber-fn:N invalidates footnotes that appear as the
first thing on a line. Here's a test file including the recipe.
--8<---------------cut here---------------start------------->8---
* Bla
This is a line in which the following footnote that is inserted exactly
[fn:1] is the first thing in that line. And now invoke
org-footnote-renumber-fn:N and see it breaking.
* Footnotes
[fn:1] Test
--8<---------------cut here---------------end--------------->8---
Note, that in larger org files, it's likely that you don't even notice
that the footnotes break.
Once I added a patch on patchwork that fixed this issue, and that's
shown as "accepted".
http://patchwork.newartisans.com/patch/705/
I think, I've marked it as deferred or so myself because I've thought
the issue was fixed in the meantime, but that doesn't seem to be true.
Here's an updated patch.
* lisp/org-footnote.el (org-footnote-goto-definition): This patch
makes sure the function says when a definition has been found.
Thus, moving from the reference to the definition doesn't offer to
create the latter again.
* lisp/org-footnote.el (org-footnote-create-definition): When the tag
is missing, it is created before any existing footnote, or at end of
buffer. In the latter case, the marker pointing at the position
where the new footnote is going to be inserted (at end of buffer)
stays before the tag. This patch makes sure that the marker will be
kept after the tag.
* lisp/org-footnote.el (org-footnote-normalize): be sure to separate
the last footnote definition from the rest of the buffer.
Thanks to Jambunathan K for reporting this.
* lisp/org-footnote.el (org-footnote-get-definition): the function has
to widen buffer if definition has not been found in the current
narrowed part. Be sure to restore that restriction once the
definition is found.
Also remove blank lines before the ";;; org*el ends here" declarations.
Having a "Version" header forced us to update every file when releasing a
new version of Org; it also forced us to update every file when merging Org
with Emacs trunk, thus cluttering the diffs between the previously merged
version and the new one with useless information.
Glenn Morris suggested this in emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00322.html
* 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.
* lisp/org-footnote.el (org-footnote-tag-for-non-org-mode-files):
notify the opportunity to set the variable to the empty string.
(org-footnote-normalize, org-footnote-create-definition): carefully
check for inserted newlines and presence of the footnote
tag.
* lisp/org-footnote.el (org-footnote-new): use ido or iswitchb when
available when prompted for a label. Also rename a local variable to
avoid confusion with an existing function.
* lisp/org-footnote.el (org-footnote-in-valid-context-p): check
`org-protected' property before allowing to match a footnote.
(org-footnote-at-reference-p): remove an obsolete test. It's now done
in the previous function.
* lisp/org-footnote.el (org-footnote-next-reference-or-definition): if
no more footnote is found, be sure to go back to the original
position. Otherwise, point might be left on a footnote-like element
that has been dished out.
* lisp/org-footnote.el (org-footnote-create-definition): when skipping
already written footnotes definition, the algorithme would assume
each one was only one-line long.
* 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'.