* org-footnote.el (org-footnote-create-definition): Replace
`forward-line' with `org-end-of-meta-data' to skip over any
properties and/or drawers that may be present on the
`org-footnote-section' heading (default "Footnotes").
TINYCHANGE
* lisp/org-footnote.el (org-footnote-at-reference-p):
(org-footnote-at-definition-p): Rewrite using Elements library.
(org-footnote-get-next-reference): Use `org-footnote-at-reference-p'.
(org-footnote-next-reference-or-definition): Use old definition for
`org-footnote-at-definition-p' and `org-footnote-at-definition-p'.
This patch aims at reducing the calls to the inaccurate
`org-footnote-in-valid-context-p' function. However,
`org-footnote-next-reference-or-definition' still uses it because the
function is for fontification only, so 1. accuracy matters less
2. Elements has a slower worse case scenario.
* lisp/org-footnote.el (org-footnote-goto-previous-reference): Only
add to mark ring on a successful match. Improve error message when
reference is outside visible part of buffer.
(org-footnote-get-next-reference): Avoid using
`org-footnote-at-reference-p', which is inaccurate, due to
`org-footnote-in-valid-context-p'.
* testing/lisp/test-org-footnote.el (test-org-footnote/goto-previous-reference):
New test.
* lisp/org-footnote.el (org-footnote-auto-label):
(org-footnote-auto-adjust): Use simpler :safe value.
The point of the :safe value is to determine if the variable is safe,
not to check correctness of its value. Besides, lambda functions
appear as the following in *Help* buffer:
This variable is safe as a file local variable if its value
satisfies the predicate which is a byte-compiled expression.
which is not particularly clear. Let's keep :safe values simple.
* lisp/org-element.el (org-element-class): New function.
(org-element-map):
(org-element-interpret-data):
* lisp/org-footnote.el (org-footnote--allow-reference-p):
* lisp/org-src.el (org-src--on-datum-p):
* lisp/ox-odt.el (org-odt-footnote-reference):
(org-odt-table-cell):
* lisp/ox.el (org-export-data):
(org-export-expand): Use new function.
* testing/lisp/test-org-element.el (test-org-element/class): New test.
Using generic `org-element-class' allows to handle unknown, i.e.,
pseudo, object or element types. It also reduces code duplication in
`org-element-interpret-data' and `org-export-data', preventing, e.g.,
bugs as the one fixed in c58e1b5.
* lisp/org-agenda.el (org-agenda-show-the-flagging-note):
* lisp/org-footnote.el (org-footnote-goto-definition):
* lisp/org-table.el (org-table-edit-formulas): Fix straight quotes
rendered as curvy quotes in echoes messages (in emacs 25.1).
* lisp/org-table.el (org-table-align): Fix straight quotes rendered as
curvy quotes in help echo (in emacs 25.1).
* lisp/org-protocol.el (org-protocol-create-for-org):
* lisp/org-table.el (org-table-sum): Minor reformatting.
The below thread discusses why these changes were needed especially when
using emacs 25.1 or newer emacsen (that added support for rendering
back-quotes and straight quotes as left/right curvy quotes by default):
http://thread.gmane.org/gmane.emacs.orgmode/105594
Fix the quote style displayed when key-bindings are shown in
the echo via (message .. (substitute-command-keys ..)).
So below will render that single quote as curly.
(message "C-c '")
The fix (Reference:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-10/msg00234.html)
is to print that quote verbatim using the "%s" modifier:
(message "%s" "C-c '")
Also an help-echo text property value was fixed in `org-table-align'.
`substitute-command-keys' should not be used in that. Instead \\[COMMAND]
should be used directly in the string.
* lisp/org-footnote.el (org-footnote--collect-references): Include
inline references at the beginning of the line, which are allowed,
unlike regular references.
* lisp/org-footnote.el (org-footnote-re):
(org-footnote-definition-re): Do not match [1]-like constructs.
(org-footnote): Fix typo.
(org-footnote-auto-label): Do not offer to create [1]-like constructs
anymore.
(org-footnote-new): Remove reference to obsolete value in
`org-footnote-auto-label'.
(org-footnote-at-reference-p):
(org-footnote-get-next-reference):
(org-footnote-next-reference-or-definition):
(org-footnote-goto-definition):
(org-footnote-goto-previous-reference): Use new regexp.
(org-footnote-normalize-label): Remove "fn:" prefix instead of adding
it.
(org-footnote-get-definition):
(org-footnote-all-labels):
(org-footnote-unique-label): Small refactoring.
(org-footnote-create-definition):
(org-footnote-delete-definitions):
(org-footnote--clear-footnote-section):
(org-footnote--collect-references):
(org-footnote--collect-definitions):
(org-footnote--set-label):
(org-footnote-sort): New functions.
(org-footnote-auto-adjust-maybe):
(org-footnote-action): Use new functions. Small refactoring.
(org-footnote-renumber-fn:N): Refactor code. Handle nested footnotes.
(org-footnote-normalize): Turn footnotes into [fn:N] construct instead
of [N].
* testing/lisp/test-org-footnote.el (test-org-footnote/delete):
(test-org-footnote/goto-definition):
(test-org-footnote/normalize): Update test
(test-org-footnote/sort):
(test-org-footnote/renumber-fn:N): New tests.
(test-org-footnote/normalize-outside-org): Remove test.
* lisp/org-element.el (org-element-export-block-parser):
(org-element--current-element): Use new syntax for export blocks.
(org-element-block-name-alist): Remove.
* lisp/ox.el (org-export-register-backend):
(org-export-define-derived-backend): Remove :export-block keyword from
back-end's definition.
(org-export-expand-include-keyword): Use new syntax for include
keywords.
* lisp/ox-ascii.el (ascii):
* lisp/ox-beamer.el (beamer):
* lisp/ox-html.el (html):
* lisp/ox-latex.el (latex):
(org-latex-prefer-user-labels):
* lisp/ox-man.el (man):
* lisp/ox-md.el (md):
* lisp/ox-odt.el (odt):
* lisp/ox-texinfo.el (texinfo): Propagate changes to "ox.el".
* lisp/ob-core.el (org-babel-insert-result):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new syntax.
* lisp/org.el (org-structure-template-alist): Use new syntax.
(org-protecting-blocks): Add "export" to protected blocks. Remove
back-ends blocks, which are now special blocks.
(org-fontify-meta-lines-and-blocks-1): Fontify correctly new blocks.
* lisp/org-footnote.el (org-footnote-forbidden-blocks):
* lisp/org-list.el (org-list-forbidden-blocks): Add "export" to
forbidden blocks. Remove back-ends blocks, which are now special
blocks.
* contrib/lisp/ox-extra.el: Update comments.
* testing/lisp/test-org-element.el (test-org-element/export-block-parser):
(test-org-element/export-block-interpreter):
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
* testing/lisp/test-ox.el (test-org-export/expand-include): Update tests.
Export blocks are explicitly marked as such at the syntax level to
disambiguate their parsing from special blocks. The new syntax is
#+BEGIN_EXPORT backend
...
#+END_EXPORT
instead of
#+BEGIN_backend
...
#+END_backend
As a consequence, =INCLUDE= keywords syntax is modified, e.g.,
#+INCLUDE: "file.org" HTML
becomes
#+INCLUDE: "file.org" export html