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.
* lisp/ob-lob.el (org-babel-map-call-lines): Allow mapping of code
over all call lines in a buffer.
* lisp/ob.el (org-babel-execute-buffer): Execute call lines when
executing an entire buffer.
* lisp/ob-lob.el (org-babel-lob-execute-maybe): Don't execute a call
inside a verbatim block.
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Check for example
blocks.
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/ob-keys.el (org-babel-key-bindings): Bound to C-c C-v k.
* lisp/ob.el (org-babel-map-regexp): New generic mapping macro.
(org-babel-map-inline-src-blocks): Rewritten to use new macro.
(org-babel-kill-results): Remove some or all results in the current
file.
* lisp/ob-lob.el (org-babel-map-call-lines): Map over all lob call
lines in the current file.
* doc/orgcard.tex: Document new keybinding.
* lisp/ob-lob.el (org-babel-inline-lob-one-liner-regexp): Updated to
successfully match optional trailing header arguments in square
brackets.
(org-babel-lob-get-info): Updated to match the new regexp.
* lisp/ob-lob.el (org-babel-inline-lob-one-liner-regexp): Removing
this trailing space ensures that the insertion of the results looks
nice.
* lisp/ob.el (org-babel-insert-result): Insert inline lob line results
as inline results.
* lisp/ob-exp.el (org-babel-exp-lob-one-liners): Calculate length
appropriately given the style (block or inline) of the lob line.
* lisp/ob-lob.el (org-babel-block-lob-one-liner-regexp): New regexp
specific for block lob lines.
(org-babel-inline-lob-one-liner-regexp): New regexp specific for
inline lob lines.
(org-babel-lob-one-liner-regexp): Combination of two lob regexps.
(org-babel-lob-get-info): Return info from *either* the block or
inline lob lines.
* lisp/ob-exp.el (org-babel-exp-lob-one-liners): Corrected the
structure of the resulting info list.
* lisp/ob-lob.el (org-babel-default-lob-header-args): Export the
results of call lines by default.
* lisp/ob-lob.el (org-babel-lob-get-info): including pass-through
header arguments in results variable header argument string
* lisp/ob.el (org-babel-execute-src-block): working with new header
argument setup
(org-babel-parse-header-arguments): only split header argument
strings when []'s are balanced
* lisp/ob-exp.el (org-babel-exp-results): replaced old function call
* lisp/ob-lob.el (org-babel-lob-execute): replaced old function call
* lisp/ob-ref.el (org-babel-ref-parse): removed obsolete optional
params argument, also no longer chokes when handed an
already-resolved reference
(org-babel-ref-resolve): removed obsolete optional params argument
* lisp/ob.el (org-babel-ref-parse): updated function declaration
(org-babel-get-src-block-info): replaced old function call
(org-babel-header-arg-names): indentation
(org-babel-execute-src-block): now expanding all parameters using
the newly combined org-babel-process-params
(org-babel-switch-to-session-with-code): indentation
(org-mode-hook): indentation
(org-babel-process-params): now packages all results into the
parameter alist and does variable expansion, this should no longer
be called from inside of language functions
(org-babel-expand-noweb-references): updated function call for newly
removed obsolete function parameter
* lisp/ob-lob.el (org-babel-lob-execute): now expanding variable
references before execution
* lisp/ob.el (org-babel-merge-params): better indentation, and finally
sorted out the proper replacement of conflicting variable
definitions
ob-get-src-block-info wasn't correctly returning the name of the
code block
* lisp/ob-lob.el (org-babel-lob-ingest): now returns the count of
ingested code blocks
* lisp/ob.el (org-babel-get-src-block-info): walks up possible
additional header arg lines before checking for the code block name
(org-babel-merge-params): can now handle empty variables gracefully
* ob.el (org-babel-execute-src-block-maybe): remove check for
`org-babel-no-eval-on-ctrl-c-ctrl-c'; this is done in the new
function `org-babel-execute-safely-maybe'
(org-babel-execute-maybe): new function to execute src blocks
or lob/call lines.
(org-babel-execute-safely-maybe): new function to execute src blocks
or lob/call lines via C-c C-c
(org-ctrl-c-ctrl-c-hook): remove
`org-babel-execute-src-block-maybe' and add
`org-babel-execute-safely-maybe'.
* ob-lob.el (org-ctrl-c-ctrl-c-hook): remove
`org-babel-lob-execute-maybe'
* ob-keys.el (org-babel-key-bindings): New function
`org-babel-execute-maybe' is bound to C-c C-v e and C-c C-v
C-e
* lisp/ob-lob.el (org-babel-lob-execute): changing indentation to
improve line length
(org-babel-lob-get-info): now catching indexes passed through lob
calls
(org-babel-lob-one-liner-regexp): now matches optional indexes into
variable results
Thanks to Austin Frank for suggesting these features and to Jonathan
Arkell for an implementation suggestion
This commit
- adds `org-babel-goto-named-result' for jumping to named results
- adds TAB-completion to `org-babel-goto-named-src-block'
- standardizes on "-src-" instead of "-source-" in all babel functions
- adds `org-babel-[next/previous]-src-block' functions and keybindings
- documents the above in orgcard.tex
* doc/orgcard.tex: update documentation of babel keybindings
* lisp/ob-exp.el (org-exp-res/src-name-cleanup): standardized on
"-src-" instead of "-source-"
* lisp/ob-keys.el (org-babel-key-bindings): updating keybindings for
new movement functions
* lisp/ob-lob.el (org-babel-lob-ingest): standardized on "-src-"
instead of "-source-"
* lisp/ob-ref.el (org-babel-ref-resolve-reference): standardized on
"-src-" instead of "-source-"
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): standardized on
"-src-" instead of "-source-"
* lisp/ob.el (org-babel-src-name-regexp): standardized on "-src-"
instead of "-source-"
(org-babel-src-name-w-name-regexp): adding regexp for matching
source names along with their names
(org-babel-get-src-block-info): using new named source block regexp
(org-babel-result-regexp): adding optional whitespace after result
regexp
(org-babel-result-w-name-regexp): adding regexp for matching results
which have names
(org-babel-named-src-block-regexp-for-name): standardized on "-src-"
instead of "-source-"
(org-babel-map-src-blocks): standardized on "-src-" instead of
"-source-"
(org-babel-where-is-src-block-head): standardized on "-src-" instead of
"-source-"
(org-babel-goto-named-src-block): standardized on "-src-" instead of
"-source-", also added completing read
(org-babel-src-block-names): collects source block names from a file
or the current buffer
(org-babel-goto-named-result): function for jumping to a named
result
(org-babel-result-names): returns results names from a file or the
current buffer
(org-babel-next-src-block): jump to the next source block
(org-babel-previous-src-block): jump to the previous source block