* lisp/ob-core.el (org-babel-read-element): New function.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new function. Refactor
code.
(org-babel-ref-at-ref-p): Remove function.
* testing/lisp/test-ob.el (test-ob/ignore-reference-in-commented-headings):
New test.
* testing/lisp/test-ob.el (test-ob/resolve-code-blocks-before-data-blocks):
Remove test
The second test is removed because names are expected to be unique.
There is no order to expect when more than one uses the same name.
Reported-by: myq <myqlarson@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/102464>
These changes are the combination of the commits below (in order
applied). Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits. Changes to message and help quote
display for Emacs 25 seem to be here to stay. The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.
Quoting fixes in lisp/org
6cd2629bd1b3ce77d29ac28e29237c94a4197116
Paul Eggert
Mon Aug 31 00:29:40 2015 -0700
More-conservative ‘format’ quote restyling
fbb5531fa11d13854b274d28ccd329c9b6652cfc
Paul Eggert
Sun Aug 23 22:39:06 2015 -0700
Prefer directed to neutral quotes
875a5d0ead827d3da32ecbd30e739a29f07bbc87
Paul Eggert
Mon Aug 24 23:57:25 2015 -0700
Escape ` and ' in doc
19532d147b431a4fe34f088d6de07891c48e2c5c
Paul Eggert
Tue Sep 1 18:23:21 2015 -0700
Fix some more docstring etc. quoting problems
26bd978d87dfbf9baa115cd961a67d42b416c4bf
Paul Eggert
Thu Sep 3 15:32:54 2015 -0700
Go back to grave quoting in source-code docstrings etc.
6afef3f6ca2f3009c722b84e249903b7f807b044
Paul Eggert
Mon Sep 7 16:09:27 2015 -0700
* lisp/ob-core.el (org-babel-exp-reference-buffer): New variable, as
a replacement for `org-current-export-file'.
(org-babel-check-confirm-evaluate): Use new variable.
* lisp/ob-exp.el (org-babel-exp-in-export-file): Use new variable.
(org-babel-exp-get-export-buffer): Remove function.
(org-babel-exp-process-buffer): Change signature.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new variable during
export in order to properly resolve references.
* lisp/ox.el (org-export-execute-babel-code): Use new variable.
* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
Remove a cond branch as it is always
false (`org-current-export-file' couldn't be a string).
* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines): Update
test.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Update test.
* testing/lisp/test-ob-exp.el (ob-export/reference-in-post-header):
New test.
During export, Babel executes sequentially all blocks in the buffer
being exported. This can lead to modifications preventing some
references from being resolved. As a workaround, Babel stores
a pristine copy of the buffer in a variable so it can always find
needed references.
Before this patch, the variable storing this copy was
`org-current-export-file' and was dynamically bound in "ox.el". It
was used to resolve noweb references (`org-babel-expand-noweb-references')
but not regular references (`org-babel-ref-resolve').
Now, the variable is `org-babel-exp-reference-buffer' and it is bound
from `org-babel-exp-process-buffer'. It is used to resolve all
references. In particular, this allows to use references in :post
header.
Thanks to Jarmo Hurri for reporting it.
* lisp/ob-ref.el (org-babel-ref-parse): If
`org-babel-current-src-block-location' is a marker, it can be from
another buffer, use marker-position instead in this case.
Introduced with r114064 on Emacs trunk. Not sure if this is a bug in
Org or Emacs, but the patch restores the previous behaviour.
* lisp/ob-core.el (org-babel-execute-src-block): Ensure that the
location is set before anything else is done.
* lisp/ob-ref.el (org-babel-ref-parse): Evaluate Emacs Lisp values in
header arguments at the location of the original code block.
* testing/lisp/test-ob.el (test-ob/location-of-header-arg-eval): Test
defending the new header argument evaluation behavior.
This patch ensure Org-mode will build on all supported versions of
Emacs, after the renaming of the cl macros behind the cl- prefix in the
recent Emacs trunk.
* lisp/org-compat.el (org-flet): Compatibility function now that flet
has been removed from cl-macs.
(org-labels): Compatibility function now that labels has been removed
from cl-macs.
* lisp/ob-R.el (org-compat): Require org-compat.
* lisp/ob-comint.el: Require org-compat.
* lisp/ob-exp.el (org-babel-exp-do-export): Switch to compatibility
function.
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Switch to
compatibility function.
* lisp/ob-lob.el (org-babel-lob-get-info): Switch to compatibility
function.
(org-babel-lob-execute): Switch to compatibility function.
* lisp/ob-python.el (org-babel-python-evaluate-session): Switch to
compatibility function.
* lisp/ob-ref.el (org-babel-ref-index-list): Switch to compatibility
function.
* lisp/ob-sh.el (org-babel-sh-var-to-string): Switch to compatibility
function.
* lisp/ob-tangle.el (org-babel-load-file): Switch to compatibility
function.
(org-babel-tangle): Switch to compatibility function.
(org-babel-spec-to-string): Switch to compatibility function.
* lisp/ob.el (org-babel-view-src-block-info): Switch to compatibility
function.
(org-babel-execute-src-block): Switch to compatibility function.
(org-babel-edit-distance): Switch to compatibility function.
(org-babel-switch-to-session-with-code): Switch to compatibility
function.
(org-babel-sha1-hash): Switch to compatibility function.
(org-babel-balanced-split): Switch to compatibility function.
(org-babel-join-splits-near-ch): Switch to compatibility function.
(org-babel-get-rownames): Switch to compatibility function.
(org-babel-format-result): Switch to compatibility function.
(org-babel-insert-result): Switch to compatibility function.
(org-babel-examplize-region): Switch to compatibility function.
(org-babel-merge-params): Switch to compatibility function.
(org-babel-noweb-p): Switch to compatibility function.
(org-babel-expand-noweb-references): Switch to compatibility function.
* lisp/org-bibtex.el (org-bibtex-headline): Switch to compatibility
function.
(org-bibtex-fleshout): Switch to compatibility function.
(org-bibtex-read): Switch to compatibility function.
(org-bibtex-write): Switch to compatibility function.
* lisp/org-exp-blocks.el (org-export-blocks-preprocess): Switch to
compatibility function.
* lisp/org-exp.el (org-export-format-source-code-or-example): Switch to
compatibility function.
* lisp/org-macs.el (org-called-interactively-p): Indentation fix.
* lisp/org-mouse.el (org-mouse-timestamp-today): Switch to compatibility
function.
(org-mouse-set-priority): Switch to compatibility function.
(org-mouse-popup-global-menu): Switch to compatibility function.
(org-mouse-context-menu): Switch to compatibility function.
* lisp/org-plot.el (org-plot/gnuplot-to-grid-data): Switch to
compatibility function.
(org-plot/gnuplot-script): Switch to compatibility function.
* lisp/org.el (org-entry-get): Switch to compatibility function.
(org-fill-paragraph): Switch to compatibility function.
(org-auto-fill-function): Switch to compatibility function.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.
This commit reverts back the maint branch to its state before
merging the master branch. From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
* lisp/ob-ref.el (org-babel-ref-split-args): Now uses
`org-babel-balanced-split'.
* testing/lisp/test-ob.el (test-ob/splitting-variable-lists-in-references):
Test new working behavior.
* org.el (org-block-regexp)
(org-heading-keyword-regexp-format)
(org-heading-keyword-maybe-regexp-format): Move up to keep the
byte-compiler happy.
* org-special-blocks.el (org-html): Require 'org-html.
(org-open-par, org-close-par-maybe): Declare as functions.
* ob.el (org-reduce): Declare as a function.
(org-current-export-file): Declare.
* ob-ref.el (org-babel-update-intermediate): Make a defvar.
* lisp/ob-ref.el (org-babel-update-intermediate): New custom variable.
(org-babel-ref-resolve): Optionally update the in-buffer results of
code blocks which are evaluated to resolve references.
* lisp/ob-ref.el (org-babel-ref-resolve): Search for named code blocks
before named data.
* lisp/ob.el (org-babel-named-data-regexp-for-name): New function for
finding named data.
* testing/lisp/test-ob.el (test-ob/resolve-code-blocks-before-data-blocks):
Test to ensure that named references are resolved in the correct
order.
* lisp/ob-ref.el (org-babel-ref-resolve): Don't change location when
looking at the contents.
* testing/lisp/test-ob.el (test-ob/catches-all-references): Test
enforcing the correct behavior.
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <schulte.eric@gmail.com> wrote:
>
>> The attached updated patch fixes a bug in the original.
>>
>
> Minor problem in applying:
>
> ,----
> | $ git apply ~/Mail/inbox/724
> | /home/nick/Mail/inbox/724:671: trailing whitespace.
> | #+name:
> | /home/nick/Mail/inbox/724:599: new blank line at EOF.
> | +
> | warning: 2 lines add whitespace errors.
> `----
The attached version fixes these issues, Thanks -- Eric
>From 0e43d59ee8d46a63f86780a502de726271bc39de Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 28 Oct 2011 10:44:21 -0600
Subject: [PATCH] removing code block, results and call-line synonyms -- BREAKING CHANGE
Following a round of on-list discussion many code block synonyms have
been removed, moving forward the following syntax is valid.
- call lines are specified with #+call:
- code blocks are named with #+name:
- results are named with #+name:, however results generated by a code
block may still be labeled with #+results:, and tables named with
#+tblname: will be considered to be named results
The following function may be used to update an existing Org-mode
buffer to the new syntax.
(defun update-org-buffer ()
"Update an Org-mode buffer to the new data, code block and call line syntax."
(interactive)
(save-excursion
(flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
"\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
(update (re new)
(goto-char (point-min))
(while (re-search-forward re nil t)
(replace-match new nil nil nil 1))))
(let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
(lob-re (to-re '("LOB")))
(case-fold-search t))
(update old-re "name")
(update lob-re "call")))))
Note: If an old version of Org-mode (e.g., the one shipped with Emacs)
is installed on your system many of the important variables will
be pre-defined with a defvar and *will not* have their values
automatically updated, these include the following.
- org-babel-data-names
- org-babel-result-regexp
- org-babel-src-block-regexp
- org-babel-src-name-regexp
- org-babel-src-name-w-name-regexp
It may be necessary to either remove the source code of older
versions of Org-mode, or to explicitly evaluate the ob.el file.
* lisp/ob-exp.el (org-exp-res/src-name-cleanup): Updated
Documentation.
* lisp/ob-lob.el (org-babel-block-lob-one-liner-regexp): Updated
regular expression.
(org-babel-inline-lob-one-liner-regexp): Updated regular expression.
* lisp/ob-ref.el (org-babel-ref-resolve): Notice when something that
looks like a data results may actually be a code block.
* lisp/ob-table.el: Updated documentation.
* lisp/ob.el (org-babel-src-name-regexp): Simplified regexp.
(org-babel-get-src-block-info): Updated match strings.
(org-babel-data-names): Simplified acceptable names.
(org-babel-find-named-block): Indentation.
(org-babel-find-named-result): Updated to not return a code block as
a result.
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Removing
references to old syntactic elements.
(org-additional-option-like-keywords): Removing references to old
syntactic elements.
* contrib/babel/library-of-babel.org: Updated to make use of the new
syntax.
* testing/examples/babel-dangerous.org: Updated to make use of the new
syntax.
* testing/examples/babel.org: Updated to make use of the new syntax.
* testing/examples/ob-awk-test.org: Updated to make use of the new
syntax.
* testing/examples/ob-fortran-test.org: Updated to make use of the new
syntax.
* testing/lisp/test-ob.el: Removed two bad tests which tested the
literal values of old regular expressions rather than their
behavior.
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