Commit Graph

465 Commits

Author SHA1 Message Date
Eric Schulte a9510349ea Merge branch 'origin-maint' 2012-01-23 11:07:36 -07:00
Eric Schulte 978fd46069 don't report valid header arguments as suspicious
* lisp/ob.el (org-babel-check-src-block): Don't report valid header
  arguments as suspicious.
2012-01-23 11:07:27 -07:00
Eric Schulte 10f26fb805 Merge branch 'origin-maint' 2012-01-20 12:00:31 -07:00
Eric Schulte 4f5b6317b5 correctly position point when mapping hits an inline code block
* lisp/ob.el (org-babel-map-executables): Correctly position point when
  mapping hits an inline code block.
2012-01-20 11:59:53 -07:00
Eric Schulte 97e8e03eea Ensure params are incorporated *before* checking if evaluation is legal
* lisp/ob.el (org-babel-execute-src-block): Ensure params are
  incorporated *before* checking if evaluation is legal.
2012-01-20 11:44:12 -07:00
Eric Schulte bded90ba48 Disambiguate intersection name.
* lisp/ob.el (org-babel-noweb-p): Disambiguate intersection name.
2012-01-19 15:04:36 -07:00
Eric Schulte 3be1f755b0 Merge branch 'origin-maint' 2012-01-19 11:07:41 -07:00
Eric Schulte 70c58b93f1 Revert "remove #+name and #+result hiding"
This reverts commit 8a8a56c277.
2012-01-19 11:07:12 -07:00
Eric Schulte b44c08dd45 remove all calls to `gensym'
* lisp/ob.el (org-babel-map-src-blocks): Replace gensym with make-symbol.
  (org-babel-map-inline-src-blocks): Replace gensym with make-symbol.
  (org-babel-map-call-lines): Replace gensym with make-symbol.
  (org-babel-map-executables): Replace gensym with make-symbol.
2012-01-19 11:07:11 -07:00
Eric Schulte 102adf13d4 Merge branch 'origin-maint' 2012-01-12 18:12:19 -07:00
Eric Schulte fc92b2e2fe fix whole-buffer evaluation order and symbol intrusion in related macros
* lisp/ob.el (org-babel-map-src-blocks): Don't pollute symbol space.
  (org-babel-map-inline-src-blocks): Don't pollute symbol space.
  (org-babel-map-call-lines): Don't pollute symbol space.
  (org-babel-map-executables): Map over *all* executable Org-mode
  elements.
  (org-babel-execute-buffer): Execute elements in buffer order instead
  of arbitrarily.
2012-01-12 18:11:52 -07:00
Eric Schulte d8aa48f77b capitalize RESULTS in :wrap'd code block results
* lisp/ob.el (org-babel-insert-result): Capitalize RESULTS in :wrap'd
  code block results.
2012-01-11 19:43:00 -07:00
Eric Schulte 43fb184634 Merge branch 'origin-maint' 2012-01-11 13:54:54 -07:00
Eric Schulte 9ac673c5e2 default to all-caps #+RESULTS: for code-block generated content
* lisp/ob.el (org-babel-results-keyword): New user-configurable
  results keyword.
  (org-babel-where-is-src-block-result): Use new user-configurable
  results keyword.
2012-01-11 13:54:20 -07:00
Eric Schulte abf3060e47 new "no-export" option to :noweb header argument, and consolidated noweb logic
* lisp/ob-exp.el (org-babel-exp-src-block): Use `org-babel-noweb-p'.
  (org-babel-exp-inline-src-blocks): Use `org-babel-noweb-p'.
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Use
  `org-babel-noweb-p'.
* lisp/ob.el (org-babel-execute-src-block): Use `org-babel-noweb-p'.
  (org-babel-expand-src-block): Use `org-babel-noweb-p'.
  (org-babel-load-in-session): Use `org-babel-noweb-p'.
  (org-babel-merge-params): Use `org-babel-noweb-p'.
  (org-babel-noweb-p): New function used to determine if noweb
  expansion should be carried out in a given context.
2012-01-11 10:15:20 -07:00
Eric Schulte 73b67cd8a5 introduce new ":wrap" header argument for wrapping results in named blocks
* lisp/ob.el (org-babel-common-header-args-w-values): Add the new
  header argument name.
  (org-babel-insert-result): Respect the value of the :wrap header
  argument when inserting results.
  (org-babel-result-end): Find the end of arbitrarily named result
  blocks.
2012-01-10 09:45:43 -07:00
Eric Schulte 37da88caa3 resurrect dropped pieces of a previous patch
* lisp/ob.el (org-babel-expand-noweb-references): Resurrect dropped
  pieces of a previous patch.
2012-01-05 10:44:11 -07:00
Eric Schulte d35c79aca9 resurrect dropped pieces of a previous patch
* lisp/ob.el (org-babel-expand-noweb-references): Resurrect dropped
  pieces of a previous patch.
2012-01-05 10:42:17 -07:00
Eric Schulte 2c2e1a5448 fixed bug in org-babel-balanced-split when run on Emacs22
Thanks to Martyn Jago for the test case

* lisp/ob.el (org-babel-balanced-split): Explicit checking if list
  before calling member.
* testing/lisp/test-ob.el (test-ob/org-babel-balanced-split): Testing
  the new Emacs22-proof behavior.
2012-01-03 11:45:27 -07:00
Eric Schulte 8cffe3aabf fixed bug in org-babel-balanced-split when run on Emacs22
Thanks to Martyn Jago for the test case

* lisp/ob.el (org-babel-balanced-split): Explicit checking if list
  before calling member.
* testing/lisp/test-ob.el (test-ob/org-babel-balanced-split): Testing
  the new Emacs22-proof behavior.
2012-01-03 11:44:46 -07:00
Bastien Guerry e44d2975ff Fix copyright (to 2012) year and Org version (to 7.8.03). 2012-01-03 18:47:01 +01:00
Bastien Guerry 9167cba326 Merge branch 'master' into maint 2012-01-03 08:31:58 +00:00
Eric Schulte 1471af0b44 Resolve :noweb-ref when set at the property level during noweb expansion
* lisp/ob.el (org-babel-expand-noweb-references): Rather than using a
  pure regexp solution to resolve noweb references, actually check the
  information of every code block in the buffer.  This will cause a
  slowdown in noweb reference expansion, but is necessary for correct
  behavior.
2012-01-03 09:17:03 +01:00
Eric Schulte a2cdccf5cb move `org-babel-lob-one-liner-regexp' into ob.el to fix autoloading error
* lisp/ob.el (org-babel-map-call-lines): Moved this file from
  ob-lob.el into ob.el to ease dependency pains.
2012-01-03 09:12:36 +01:00
Eric Schulte 9e4a6f3781 optional "quick and dirty" :noweb reference expansion
* lisp/ob.el (*org-babel-use-quick-and-dirty-noweb-expansion*):
  Controls the method in which noweb references are expanded.
  (org-babel-expand-noweb-references): Bring back the option for
  regexp-based noweb expansion.
2012-01-02 10:59:53 -07:00
Eric Schulte 18708a2b5a Resolve :noweb-ref when set at the property level during noweb expansion
* lisp/ob.el (org-babel-expand-noweb-references): Rather than using a
  pure regexp solution to resolve noweb references, actually check the
  information of every code block in the buffer.  This will cause a
  slowdown in noweb reference expansion, but is necessary for correct
  behavior.
2011-12-29 12:51:03 -07:00
Eric Schulte 34eb48dc3f move `org-babel-lob-one-liner-regexp' into ob.el to fix autoloading error
* lisp/ob.el (org-babel-map-call-lines): Moved this file from
  ob-lob.el into ob.el to ease dependency pains.
2011-12-17 09:04:20 -07:00
Bastien Guerry e56e2c8760 Silent a few byte-compiler warnings.
* 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.
2011-12-12 18:04:15 +01:00
Eric Schulte 3bf8d8fd86 fixed regexp when resolving noweb references
* lisp/ob.el (org-babel-expand-noweb-references): Fixed regexp.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Test both named
  code block and noweb-ref header argument references.
2011-12-11 12:02:02 -07:00
Eric Schulte 8a8a56c277 remove #+name and #+result hiding
Given that arbitrary regions may already be hidden using a drawer the
ability to hide any named entity is redundant.  In addition the name
based hiding does not mix well with other keywords.

Thanks to Nicolas Goaziou for raising this issue and suggesting the
removal of #+name based hiding.
2011-12-11 09:51:28 -07:00
Eric Schulte 1b58f780cf faster method of collecting continuing code blocks
* lisp/ob.el (org-babel-expand-noweb-references): Rather than collect
  the info from *every* block in the current buffer, simply regexp
  search for those blocks which appear to match the continued source
  name.
2011-12-11 09:51:28 -07:00
Eric Schulte a706d16127 wrap code block results in drawers rather than blocks
* lisp/ob.el (org-babel-insert-result): Do not examplize wrapped
  scalar results, simply wrap them.
  (org-babel-result-end): Find the end of results wrapped in a RESULTS
  drawer.
2011-12-11 09:51:27 -07:00
Bastien Guerry 92d305092a Fix typos (already fixed in Emacs trunk.)
Thanks to Juanma Barranquero for spotting and fixing them in Emacs.
2011-12-06 19:20:21 +01:00
Bastien Guerry 90868e2d88 Fix typo fixed in Emacs trunk.
* ob.el (org-babel-execute-src-block): Fix typo.

Thanks to Juanma Barranquero for spotting this.
2011-11-28 15:13:04 +01:00
Eric Schulte 1234afcc54 correctly toggle visibility of named code blocks
* lisp/ob.el (org-babel-hide-result-toggle): Skip over header argument
  lines when toggling named code block visibility.
2011-11-22 08:05:34 -07:00
Eric Schulte a998cae722 the :eval header argument now takes 4(6) possible values
* doc/org.texi (eval): Documenting the full range of :eval header
  argument values.
* lisp/ob.el (org-babel-confirm-evaluate): Adding support for new
  range of :eval header arguments.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Testing the
  :eval header argument.
2011-11-22 07:32:39 -07:00
Eric Schulte edef1fa5ca ":eval non-export" inhibits evaluation during export
* doc/org.texi (eval): Documentation of the new :eval option.
* lisp/ob.el (org-babel-confirm-evaluate): Inhibit evaluation during
  export when eval is set to "non-export".
2011-11-21 18:19:45 -07:00
Eric Schulte 82c0f9bf69 Allow spaces around "=" in code block variable specifications
* lisp/ob.el (org-babel-join-splits-near-ch): Rejoins a list of a
  split string when a character appears on either side of the split.
  (org-babel-parse-multiple-vars): Rejoin splits around "=" signs.
2011-11-20 09:40:08 -07:00
Eric Schulte 7c21098323 Don't match partial names when resolving code or data references
* lisp/ob.el (org-babel-named-src-block-regexp-for-name): Ensure that
  partial names are not matched.
  (org-babel-named-data-regexp-for-name): Ensure that partial names
  are not matched.
* testing/lisp/test-ob.el (test-ob/do-not-resolve-to-partial-names-data):
  Test to ensure that partial names are not matched.
2011-11-16 06:15:31 -07:00
Eric Schulte 19884ab280 resolve named code blocks before named data
* 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.
2011-11-15 20:13:41 -07:00
Eric Schulte 8114cf2bc4 Gracefully handle results which are neither lists nor strings.
* lisp/ob.el (org-babel-insert-result): Gracefully handle results
  which are neither lists nor strings.
2011-11-15 15:30:35 -07:00
Eric Schulte 83dfaa5c8f named code blocks are replaced with their results
* lisp/ob.el (org-babel-find-named-result): Downcase "name" before comparison.
* testing/lisp/test-ob.el (test-ob/does-not-replace-a-block-with-the-results):
  Test that named code blocks are replaced with their results.
2011-11-15 08:56:25 -07:00
Eric Schulte 1ed12cac1a passing all tests after code block syntax changes
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Some valid
  execution contexts (e.g., call lines) look like commented lines.
* lisp/ob.el (org-babel-get-src-block-info): Empty match string
  doesn't count.
  (org-babel-process-params): Always process parameters, even if you
  don't to table splitting.
* testing/lisp/test-ob-C.el (ob-C/table): Ignore failures for this C
  test.
* testing/lisp/test-ob-fortran.el (ob-fortran/input-var): Ignore
  failures for this fortran test.
2011-11-15 08:56:24 -07:00
Eric Schulte 3af89e696a property names ending in plus accumulate
This results in the following behavior.

  #+property: var  foo=1
  #+property: var+ bar=2

  #+begin_src emacs-lisp
    (+ foo bar)
  #+end_src

  #+results:
  : 3

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=1 bar=2

  * overwriting a file-wide property
    :PROPERTIES:
    :var:      foo=7
    :END:

  #+begin_src emacs-lisp
    foo
  #+end_src

  #+results:
  : 7

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=7

  * appending to a file-wide property
    :PROPERTIES:
    :var+:      baz=3
    :END:

  #+begin_src emacs-lisp
    (+ foo bar baz)
  #+end_src

  #+results:
  : 6

  #+begin_src emacs-lisp
    (org-entry-get (point) "var" t)
  #+end_src

  #+results:
  : foo=1 bar=2 baz=3

* lisp/org.el (org-update-property-plist): Updates a given property
  list with a property name and a property value.
  (org-set-regexps-and-options): Use org-update-property-plist.
  (org-entry-get): Use org-update-property-plist.
* testing/examples/property-inheritance.org: Example file for testing
  appending property behavior.
* testing/lisp/test-property-inheritance.el: Tests of appending
  property behavior.
* lisp/ob.el (org-babel-balanced-split): Allow splitting on single
  characters as well as groups of two characters.
  (org-babel-parse-multiple-vars): Split variables on single spaces.
2011-11-15 08:56:24 -07:00
Eric Schulte 7e93b90f88 Standardized code block keywords
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.
2011-11-15 08:56:24 -07:00
Eric Schulte 67a26e0141 execute call lines when executing an entire buffer
* 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.
2011-11-09 14:35:04 -07:00
Eric Schulte 4cf9de5ea0 don't disassemble tables twice on export
* lisp/ob.el (org-babel-process-params): Don't disassemble tables
  twice.
2011-11-09 14:12:05 -07:00
Eric Schulte 1134385a87 better handling of multiple-variable :var code block header arguments
* lisp/ob.el (org-babel-parse-multiple-vars): Trimming excess
  white space from split variables.
2011-10-28 13:58:33 -06:00
Bastien Guerry ecf5368afe ob.el: Fix byte-compiler warning about free variable. 2011-10-22 15:28:01 +02:00
Eric Schulte 93bdeb9212 two more quick fixes
* lisp/ob.el (org-babel-balanced-split): Balance both [] and ()
  groupings.
  (org-babel-parse-header-arguments): Be sure to replace removed ":"
  characters.
2011-10-21 11:36:06 -06:00
Eric Schulte 0bcb248ee6 quick fix for a tiny bug
* lisp/ob.el (org-babel-parse-header-arguments): Quick fix for a tiny bug.
2011-10-21 11:21:39 -06:00
Eric Schulte 4c3d289faf Now allow multiple "var" specifications behind a single ":var"
* lisp/ob.el (org-babel-params-from-properties): Now splits multiple
  var arguments behind a single ":var".
  (org-babel-balanced-split): Separated balanced splitting of strings
  out into a new function.
  (org-babel-parse-multiple-vars): Splits multiple var arguments
  behind a single ":var".
2011-10-21 11:15:18 -06:00
Eric Schulte 080e2decbc removing `org-babel-params-from-buffer' and #+PROPERTIES: entirely
* lisp/ob.el: Removing `org-babel-params-from-buffer' and
  #+PROPERTIES: entirely.
* lisp/ob-exp.el (org-babel-exp-src-block): Removing
  `org-babel-params-from-buffer' and #+PROPERTIES: entirely.
* lisp/ob-lob.el (org-babel-lob-execute): Removing
  `org-babel-params-from-buffer' and #+PROPERTIES: entirely.
2011-10-20 15:26:43 -06:00
Eric Schulte 04a978fde5 removing #+BABEL: lines in favor of general #+PROPERTIES: lines
* lisp/ob.el (org-babel-params-from-buffer): Removing #+BABEL: lines
  in favor of general #+PROPERTIES: lines.

* doc/org.texi (Buffer-wide header arguments): Removing documentation
  of the defunct #+BABEL: structure.
2011-10-20 13:42:31 -06:00
Eric Schulte c1ac640944 fix multi-table bug in code block colname and rowname handling
Thanks to Nick Dokos for suggesting this fix

* lisp/ob.el (org-babel-disassemble-tables): Fix multi-table bug in
  code block colname and rowname handling.
2011-10-18 10:08:48 -06:00
Eric Schulte 3e86300d6d now including language specific header arg values in insertion options
* lisp/ob.el (org-babel-insert-header-arg): Now including language
  specific header arg values in insertion options.
2011-10-09 09:31:32 -06:00
Eric Schulte d7d0230bf4 Fixed typo in org-babel-insert-header-arg.
Thanks to Torsten Wagner for pointing this out and for suggesting
  the original feature.

* lisp/ob.el (org-babel-insert-header-arg): Fixed typo.
2011-10-09 09:11:10 -06:00
Eric Schulte 9135ec76dd New helper function for inserting common code block header arguments
* lisp/ob.el (org-babel-common-header-args-w-values): New variable to
  hold common header arguments and their default values.
  (org-babel-header-arg-names): Redefined using the new common header
  arg variable.
  (org-babel-insert-header-arg): New function to help when inserting
  header arguments.
2011-10-08 16:31:50 -06:00
Eric Schulte 6844094edb Don't delete variable values when checking for assignment.
* lisp/ob.el (org-babel-get-src-block-info): Fixing bug, accidentally
  deleted variable values.
2011-09-16 09:52:34 -06:00
Eric Schulte 267015b24a differentiate between result types and wrappers
* lisp/ob.el (org-babel-merge-params): Differentiate between result
  types and wrappers.
2011-09-15 15:22:14 -06:00
Eric Schulte 11f07576cb Check that functional-syntax variables are initialized.
* lisp/ob.el (org-babel-get-src-block-info): Check that
  functional-syntax variables are initialized.
2011-09-15 09:24:29 -06:00
Eric Schulte f075ada9a1 Adding a note for a future enhancement.
* lisp/ob.el (org-babel-check-src-block): Adding a note for a future
  enhancement.
2011-09-15 09:11:12 -06:00
Eric Schulte 0037ef9261 more robust to code blocks with empty bodies
* lisp/ob.el (org-babel-parse-src-block-match): More robust to code
  blocks with empty bodies.
2011-09-13 09:36:03 -06:00
Eric Schulte 597e1eb4fe Don't error on empty code block body.
* lisp/ob.el (org-babel-parse-src-block-match): Don't error on empty
  code block body.
2011-09-13 08:57:29 -06:00
Eric Schulte a4e881207d better error message for unassigned variables
* lisp/ob.el (org-babel-merge-params): Better error message for
  unassigned variables.
2011-09-08 11:44:49 -06:00
Martyn Jago 223ac13486 Inline source block and test fixes * lisp/ob.el: Fixed late night refactoring error * testing/examples/babel.org: whitespace * testing/lisp/test-ob.el: Fixed test-org-babel/inline-src-block-regexp (regression error) Renamed test-org-babel/parse-header-args2 since duplicate test heading Made test-org-babel/parse-header-args less brittle 2011-09-06 08:53:07 -06:00
Martyn Jago d7d052ec7c Bug fixes to inline source block execution triggering. * lisp/ob.el: Created org-babel-get-inline-src-block-matches() to fix problems with org-ctrl-c-ctrl-c not triggering inline src block execution when point is on or after a space within the inline src block body. Also fixed execution problems where inline src block is on buffer line 1. * testing/examples/babel.org: Test data for org-babel-get-inline-src-block-matches()
* testing/lisp/test-ob.el: Tests for
  org-babel-get-inline-src-block-matches()
2011-09-06 08:52:59 -06:00
Eric Schulte 0d580520cc better code block demarcation
* lisp/ob.el (org-babel-demarcate-block): Copy headers and indent to
  column of point when a block is split.
2011-09-04 17:06:07 -06:00
Eric Schulte 0b6de9a026 corrected file insertion for inline results
* lisp/ob.el (org-babel-insert-result): Corrected file insertion for
  inline results.
2011-09-04 10:51:34 -06:00
Eric Schulte cae9f947be babel: don't check for header arguments in properties with leading ":"s
* lisp/ob.el (org-babel-params-from-properties): Don't check for
  header arguments in properties with leading ":"s.
2011-08-30 14:51:00 -06:00
Nicolas Goaziou 2ff74fc5b6 ob: allow inline src blocks to start at bol
* lisp/ob.el (org-babel-inline-src-block-regexp): Allow regexp to
  start at bol.
2011-08-29 16:05:18 -06:00
Achim Gratz ccc99317de backport copyright and license headers from Emacs trunk 2011-08-24 22:32:38 +02:00
Eric Schulte 21fd1523be Don't require full variable resolution when finding results
* lisp/ob.el (org-babel-where-is-src-block-result): Don't try to
  resolve variables when simply checking if we're inside of a code
  block.
2011-08-23 09:46:32 -06:00
Eric Schulte cb449a672e improve export of inline code blocks
* lisp/ob-exp.el (org-babel-exp-inline-src-blocks): Save match data
  around `org-babel-exp-do-export' which now searches in this case.
  (org-babel-exp-results): Position the point in the inline source
  block during export evaluation.
* lisp/ob.el (org-babel-insert-result): More readable code.
2011-08-22 08:23:52 -06:00
Eric Schulte 96ad99ba07 ob: idempotent code block evaluation and result removal
* lisp/ob.el (org-babel-remove-result): Idempotent code block
  evaluation and result removal.
2011-08-19 08:58:24 -06:00
Bastien Guerry 58f1dbccf8 Remove the "Version" header in Org libraries (leave it in org.el).
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
2011-08-17 14:42:34 +02:00
Bastien Guerry 7a18799e25 Remove arch-tag at the bottom of files. 2011-08-15 20:04:38 +02:00
Bastien Guerry 904ed18bc2 Fix copyright years for elisp files in core and contrib.
Also add "This file is not part of GNU Emacs." when this is the case.
2011-08-15 15:23:11 +02:00
David Maus 545bfddeea Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-12 08:38:59 +02:00
Eric Schulte dc904a834d removed use of copy-seq from ob.el
* lisp/ob.el (org-babel-sha1-hash): Removed use of copy-seq.
2011-08-05 14:31:59 -04:00
Eric Schulte 41bf22f4dc Revert "new interactive function for removing code block results"
This reverts commit 72817926d7.
2011-08-01 15:45:58 -06:00
Eric Schulte b8ae6a6bdb Revert "fix compilation errors introduced by most recent changes"
This reverts commit 9ff7f80f51.
2011-08-01 15:31:24 -06:00
Eric Schulte 274823c858 if a code block has a body, its last character must be a newline
* lisp/ob.el (org-babel-src-block-regexp): If a code block has a body,
  its last character must be a newline.
2011-07-29 16:04:36 -06:00
Eric Schulte 9ff7f80f51 fix compilation errors introduced by most recent changes
* lisp/ob-exp.el (org-babel-inline-src-block-regexp): Declare this variable.
* lisp/ob.el (defvar): Wrap variable declaration in eval-when-compile.
2011-07-29 10:36:39 -06:00
Eric Schulte 72817926d7 new interactive function for removing code block results
* 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.
2011-07-29 10:31:56 -06:00
emacs 7340cee33a Update website to show 7.7 as current release 2011-07-28 10:33:35 +00:00
Eric Schulte b1724e02fb adding a function for inspecting code block information e.g., header arguments
* lisp/ob.el (org-babel-view-src-block-info): New function to inspect code blocks.
* lisp/ob-keys.el (org-babel-key-bindings): Key bindings for org-babel-view-src-block-info.
* doc/orgcard.tex: Documentation of new Babel function.
2011-07-25 10:50:56 -06:00
Eric Schulte 4b6bfab817 ob: only call copy-seq on proper lists
* lisp/ob.el (org-babel-sha1-hash): Only call copy-seq on proper
  lists.
2011-07-21 11:05:33 -06:00
Eric Schulte 0b9cc74c56 ob: replaced call to defunct function `org-babel-result-hash'
* lisp/ob.el (org-babel-execute-src-block): Replaced call to defunct
  function `org-babel-result-hash'.
2011-07-19 07:25:35 -06:00
Eric Schulte 8854497c35 ob-exp: on export resolve hashes in the current (not original) file buffer
* lisp/ob-exp.el (org-babel-exp-results): Resolve hashes in the
  current (not original) file buffer.
* lisp/ob.el (org-babel-current-result-hash): More informative name,
  and remove useless optional argument.
2011-07-18 17:08:37 -06:00
Bastien Guerry b93da58e1f ob.el: Bugfix about `nil' body variable when parsing block.
* ob.el (org-babel-strip-protective-commas): Return `nil'
instead of an error if no argument is given.
(org-babel-parse-src-block-match): Make sure body is defined
in the let construct.
2011-07-16 18:40:36 +02:00
Eric Schulte 8834bde39f ob: strip *single* trailing newline from code block bodies 2011-07-15 09:26:43 -06:00
Eric Schulte c6e69cd85b ob: enforce "verbatim" as synonym for "scalar"
* lisp/ob-awk.el (org-babel-execute:awk): Use "verbatim" as synonym
  for "scalar".
* lisp/ob-sh.el (org-babel-sh-evaluate): Use "verbatim" as synonym for
  "scalar".
* lisp/ob-sqlite.el (org-babel-execute:sqlite): Use "verbatim" as
  synonym for "scalar".
* lisp/ob.el (org-babel-merge-params): Use "verbatim" as synonym for
  "scalar".
2011-07-10 09:42:54 -06:00
Eric Schulte cef17b6340 ob-clojure: parse odd parens when nested isnide lists
* lisp/ob.el (org-babel-script-escape): Parse odd parens when nested
  isnide lists.
2011-07-10 09:42:54 -06:00
Bastien Guerry 9c05a7c781 Bump to version 7.6 2011-07-06 21:06:03 +02:00
Eric Schulte 6ddad0a91a ob: not including export-variable headers in cache sha1
* lisp/ob.el (org-babel-sha1-hash): Improving code layout and removing
  export-variable headers in cache sha1.
2011-07-01 12:56:22 -07:00
Eric Schulte 0a0969303a ob: declare variable to appease compiler
* lisp/ob.el (org-babel-inline-lob-one-liner-regexp): Declare variable
  to appease compiler.
2011-06-29 16:29:19 -07:00
Michael Markert b3e8b3f87c adding optional argument KIND to all org-called-interactively-p function invocations
* lisp/ob.el (org-babel-sha1-hash): Adding optional argument KIND to
  all org-called-interactively-p function invocations.
* lisp/org-agenda.el (org-agenda-redo): Adding optional argument KIND to
  all org-called-interactively-p function invocations.
  (org-agenda-show-1): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-agenda-set-tags): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
* lisp/org-ascii.el (org-export-as-latin1): Adding optional argument
  KIND to all org-called-interactively-p function invocations.
  (org-export-as-latin1-to-buffer): Adding optional argument KIND to
  all org-called-interactively-p function invocations.
  (org-export-as-utf8-to-buffer): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-export-region-as-ascii): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
* lisp/org-docbook.el (org-export-region-as-docbook): Adding optional
  argument KIND to all org-called-interactively-p function
  invocations.
* lisp/org-html.el (org-export-region-as-html): Adding optional
  argument KIND to all org-called-interactively-p function
  invocations.
* lisp/org-latex.el (org-export-region-as-latex): Adding optional
  argument KIND to all org-called-interactively-p function
  invocations.
* lisp/org-table.el (org-table-blank-field): Adding optional argument
  KIND to all org-called-interactively-p function invocations.
  (org-table-current-column): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-table-current-dline): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-table-sort-lines): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-table-sum): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-table-rotate-recalc-marks): Adding optional argument KIND to
  all org-called-interactively-p function invocations.
  (org-table-eval-formula): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (orgtbl-send-table): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
* lisp/org.el (org-mode): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-copy-subtree): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-paste-subtree): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-store-link): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-todo): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
  (org-occur): Adding optional argument KIND to all
  org-called-interactively-p function invocations.
2011-06-29 16:22:58 -07:00
Bastien Guerry 2b7dbee193 Replace interactive-p with the org-called-interactively-p macro.
Interactive-p is an obsolete function as of Emacs 23.2.
`org-called-interactively-p' takes care of the current (x)Emacs
version and use either `interactive-p' (for XEmacs and Emacs<23.2)
or `called-interactively-p'.
2011-06-29 18:24:08 +02:00
Eric Schulte b055f0d372 ob: escaping scripts now treats {} in the same manner as []
* lisp/ob.el (org-babel-script-escape): Treats {} in the same manner
  as [] and allows for forcing string conversion.
2011-06-28 16:38:30 -07:00
Eric Schulte 5b7646ce08 ob: expand noweb references to headline contents
* lisp/ob-ref.el (org-babel-ref-goto-headline-id): Split out into its
  own function.
  (org-babel-ref-headline-body): Split out into its own function.
  (org-babel-ref-resolve): Using new functions, and alignment.
* lisp/ob.el (org-babel-ref-goto-headline-id): Declare function.
  (org-babel-ref-headline-body): Declare function.
  (org-babel-expand-noweb-references): Now expands noweb references to
  headlines during expansion.
2011-06-28 13:04:58 -07:00
Eric Schulte 27c3cad589 ob: preserve the order of variable parameters
* lisp/ob.el (org-babel-merge-params): Ensure variable parameters are
  not reversed.

* lisp/ob-ref.el (org-babel-ref-split-args): Ensure variable
  parameters are not reversed.
2011-06-27 11:31:12 -07:00
Eric Schulte d1f0ae650f ob: fix results insertion for inline blocks which happen to start a line
* lisp/ob.el (org-babel-insert-result): Fix results insertion for
  inline blocks which happen to start a line.
2011-06-27 10:36:27 -07:00
Eric Schulte 9e686bd681 ob: ensure that un-named variables are assigned correctly
* lisp/ob.el (org-babel-merge-params): Do not reverse variable order,
  and be sure to increment variable index as appropriate.
2011-06-25 15:20:05 -07:00
Eric Schulte 1b95d2e9ce ob: unnamed variables are assigned in order
* lisp/ob.el (org-babel-merge-params): If variables are not named they
  are assigned in order.
2011-06-25 14:11:53 -07:00
Eric Schulte 4127e53cda ob: remove code comments pointing to online documentation
* lisp/ob.el: Remove code comment about online documentation.
* lisp/ob-exp.el: Remove code comment about online documentation.
* lisp/ob-lob.el: Remove code comment about online documentation.
2011-06-25 13:17:31 -07:00
Eric Schulte 3d60c1a1d8 ob: replace call to called-interactively-p with backwards-compatible interactive-p
* lisp/ob.el (org-babel-sha1-hash): Replace call to
  called-interactively-p with backwards-compatible interactive-p.
2011-06-24 19:48:10 -07:00
Eric Schulte 6c771d236d ob: inserting inline call block results appropriately
* 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.
2011-06-24 14:53:30 -07:00
Eric Schulte 01ebf445aa ob: adding noweb-ref to the list of header argument names
* lisp/ob.el (org-babel-header-arg-names): Adding noweb-ref to the
  list of header argument names.
2011-06-15 21:49:55 -07:00
Eric Schulte 8c37281cb6 ob-tangle: continued code blocks now implemented with the :noweb-ref header arg
Now *all* code blocks which either are named `ref-name' or have the
  :noweb-ref header argument value `ref-name' will have their bodies
  concatenated when resolving the noweb reference <<ref-name>>.

* lisp/ob.el (org-babel-expand-noweb-references): Concatenating all
  bodies with the appropriate name or :noweb-ref header argument.
2011-06-15 21:14:03 -07:00
Eric Schulte 978cdf276d Babel: code block may have empty bodies, now passing all tests
* lisp/ob.el (org-babel-src-block-regexp): Babel: code block may have
  empty bodies.
* testing/lisp/test-ob-tangle.el
  (ob-tangle/no-excessive-id-insertion-on-tangle): Updated the ID.
* testing/lisp/test-ob.el (test-org-babel/src-block-regexp): Cleaned
  up the test.
  (test-org-babel/default-header-args): Removed trivial test.
  (test-org-babel/get-header): Indentation.
  (test-org-babel/sha1-hash): Updated Hash for new sorting schema.
2011-06-14 13:41:32 -07:00
Eric Schulte 95f9aa5ff5 fixing compiler warnings for Babel functions
* lisp/ob-R.el (ess-local-process-name): This variable wasn't known to
  be defined.
* lisp/ob-lisp.el (org-babel-lisp-dir-fmt): This defcustom now has a
  group specified.
* lisp/ob-tangle.el (org-bracket-link-regexp): This variable wasn't
  known to be defined.
  (org-babel-tangle-combine-named-blocks): Roll my own version of a
  forbidden common lisp function.
* lisp/ob.el (org-babel-sha1-hash): Using a non-deprecated version of
  called-interactively.
2011-06-14 11:23:56 -07:00
Lawrence Mitchell cfb05268f4 lisp/ob.el: Don't modify babel info when hashing it
* lisp/ob.el (org-babel-sha1-hash): Don't modify info argument by
side-effect when sorting result-params list.

copy-sequence only does shallow copies, so if we're going to modify a
sub-list, we need to make sure we copy it first.
2011-06-03 07:04:02 -06:00
Lawrence Mitchell 3f61432898 lisp/ob.el: Fix org-babel-result-regexp to match users
* lisp/ob.el (org-babel-result-regexp): Use non-shy group around
org-babel-data-names.

By default regexp-opt returns a shy group around its arguments.  But
users of org-babel-result-regexp expect the third match-string to
contain the hash.  With a shy group, the second match-string contains
the hash.
2011-06-02 12:07:21 -06:00
Eric Schulte 2da0ba6024 ob: keep \n inside of the code block body
* lisp/ob.el (org-babel-src-block-regexp): Keep the now-mandatory
  newline inside of the code block body.
2011-05-14 08:12:23 -06:00
Sean O'Halpin 12faa69330 * lisp/ob.el: Avoid spurious matches to literal
"#+end_src" inside a source block.

Added newline to org-babel-src-block-regexp.
2011-05-14 08:11:07 -06:00
Eric Schulte 7d12d45778 ob: new function to check header arguments for errors C-c C-v c
* doc/orgcard.tex: Adding line for org-babel-check-src-block.
* lisp/ob-keys.el (org-babel-key-bindings): Adding key sequence for
  org-babel-check-src-block.
* lisp/ob.el (org-babel-expand-src-block): Fit within 80 cols.
  (org-babel-edit-distance): Returns the edit distance of two strings.
  (org-babel-check-src-block): Check a code block for errors.
2011-05-13 10:54:44 -06:00
Eric Schulte ec293ae62b configurable names for inline data labels
* lisp/ob-ref.el (org-babel-ref-resolve): Using the new result regexp.
* lisp/ob.el (org-babel-data-names): Configurable list of names of data.
  (org-babel-result-regexp): Using new results regexp.
2011-05-06 14:45:38 -06:00
Eric Schulte 60864e851b ob: now looking for header arguments in #+Properties: as well as #+Babel:
* lisp/ob.el (org-babel-params-from-buffer): Now looking for header
  arguments in #+Properties: as well as #+Babel:.  Also, we're no
  longer caching these results into a file local variable.
2011-04-14 20:37:21 -06:00
Eric Schulte 7021f70f02 ob: fix collection of table column names during export
* lisp/ob.el (org-babel-process-params): Make this function
  idempotent, as it will sometimes be called multiple times.
2011-04-04 11:28:45 -06:00
Eric Schulte d0a4ed53f1 ob: new header argument `padline' controls newline padding around tangled code
* lisp/ob-tangle.el (org-babel-spec-to-string): Check value of padline
  on tangling, no longer use the now-removed variable
  `org-babel-tangle-pad-newline'.
* lisp/ob.el (org-babel-header-arg-names): Add padline to the list of
  header argument names.
  (org-babel-default-header-args): Set the default value of padline to
  "yes".
  (org-babel-merge-params): Cleaned up the merge logic, added padline.
* doc/org.texi (padline): Documentation of the new padline header
  argument.
2011-03-15 11:16:09 -06:00
Eric Schulte ae68febfbb ob: adding "shebang" to known code block header argument names
* lisp/ob.el (org-babel-header-arg-names): Adding "shebang" to known
  code block header argument names.
2011-03-15 10:44:26 -06:00
emacs 11a10bdfe7 Update website to show 7.5 as current release 2011-03-07 14:27:39 +00:00
Eric Schulte 60a8ba556d ob: read string variable values wrapped in double quotes, removing the quotes
* lisp/ob.el (org-babel-read): Read string variable values wrapped in
  double quotes, removing the quotes.
2011-03-02 07:55:39 -07:00
Eric Schulte 03a6844054 ob: fix compiler warnings
* lisp/ob-exp.el (org-babel-exp-in-export-file): Now takes the
  language as an argument.
  (org-babel-exp-src-block): Explicitly pass language to
  `org-babel-exp-in-export-file'.
  (org-babel-exp-inline-src-blocks): Removed unused code.
  (org-babel-exp-results): Explicitly pass language to
  `org-babel-exp-in-export-file'.

* lisp/ob.el (org-babel-library-of-babel): declare variable
  (org-babel-tangle-comment-links): declare function
2011-03-01 10:52:35 -07:00
Eric Schulte cfb06bc70b removing babel declarations for no-longer-used `org-in-item-p' 2011-03-01 10:42:47 -07:00
Eric Schulte b691233171 ob: allow passing elisp vectors through to code blocks
* lisp/ob.el (org-babel-read): Pass elisp vectors through to code
  blocks.
2011-03-01 10:31:00 -07:00
Carsten Dominik c895af44d4 Fix some compiler warnings
* lisp/ob.el (org-src-lang-modes): Defvar.
(org-at-item-p): Declare function.
* lisp/ob-calc.el (calc-store): Require.
(var-syms): Defvar.
* lisp/ob-python.el (py-default-interpreter): Defvar.
2011-03-01 08:08:36 +01:00
Eric Schulte be0b3ca1ca ob: inhibit lisp evaluation of values read from tables and lists
* lisp/ob.el (org-babel-read-table): Inhibit lisp evaluation of values
  when reading from tables.
  (org-babel-read-list): Inhibit lisp evaluation of values when
  reading from lists.
  (org-babel-read): Add optional argument which can be used to inhibit
  lisp evaluation of value.
2011-02-28 20:06:29 -07:00
Eric Schulte d0a93cee37 ob: code block regexp now matches blocks with empty bodies
Thanks to Martyn Jago for this patch

* lisp/ob.el (org-babel-src-block-regexp): Code block regexp now
  matches blocks with empty bodies.
2011-02-27 14:38:58 -07:00
Eric Schulte cfcf493c29 ob: If escaped return value doesn't parse cleanly, then return it literally.
* lisp/ob.el (org-babel-script-escape): If script escaped value
  doesn't parse cleanly, then return it literally.
2011-02-27 14:29:01 -07:00
Eric Schulte dd31a84af6 ob: canonical presentation of header arguments when hashing
* lisp/ob.el (org-babel-sha1-hash): Sort list values to header
  arguments, and sort the words in strings.
2011-02-27 09:40:35 -07:00
Eric Schulte 426d4182b3 ob: more adjustments for new list handling
* lisp/ob-ref.el (org-babel-ref-at-ref-p): Only try to read results as
  a list if at the *beginning* of a list item.
* lisp/ob.el (org-babel-read-result): Only try to read results as a
  list if at the *beginning* of a list item.
2011-02-22 21:12:13 -07:00
Eric Schulte 1e35a5ea37 ob: updates related to list changes
* lisp/ob.el (org-babel-read-list): Reading the value of a list has
  been updated to reflect the new structure of org-mode lists in
  elisp.
  (org-babel-insert-result): Writing code block results to lists has
  been updated to reflect the new list structure.
  (org-babel-result-end): Remove a previous change to end-of-list
  marker detection
2011-02-21 12:40:49 -07:00
Eric Schulte 39192b78d2 ob: allow elisp code in results header arguments
* lisp/ob.el (org-babel-process-params): Allow elisp code in
  specification of results header arguments.
2011-02-20 02:16:43 -07:00
Eric Schulte 10d76f720a ob: adjust to changes in list format
* lisp/ob.el (org-babel-result-end): Adjust marker of list end to
  changes in the list format.
2011-02-18 06:13:29 -07:00
Nicolas Goaziou bd68169b4b org-list: reorder file, rename functions, improve comments
* lisp/ob.el (org-babel-result-end): apply renaming.
* lisp/org-exp.el (org-export-mark-list-properties): apply renaming.
* lisp/org-list.el (org-list-prevs-alist): renamed from
  org-list-struct-prev-alist.
(org-list-parents-alist): renamed from org-list-struct-parent-alist.
(org-list-write-struct): renamed from org-list-struct-fix-struct.
(org-list-parse-list, org-sort-list, org-list-indent-item-generic,
org-toggle-checkbox, org-update-checkbox-count, org-cycle-list-bullet,
org-list-repair, org-insert-item, org-move-item-up, org-move-item-up,
org-move-item-down, org-next-item, org-previous-item,
org-end-of-item-list, org-beginning-of-item-list, org-apply-on-list):
apply renaming.
(org-get-bullet): removed function, as it is not needed anymore.
2011-02-18 12:45:11 +01:00
Nicolas Goaziou b219690f05 ob: compute correct end position when results are a list
* lisp/ob.el (org-babel-result-end): end position is end of current
  sublist instead of bottom point, as results might be inserted in a
  list themselves.
2011-02-18 12:45:10 +01:00
Nicolas Goaziou 2adbcfffe1 Remove uses of deprecated top-point and bottom-point functions
* lisp/org.el (org-skip-over-state-notes,org-store-log-note): use new
  accessors.

* list/ob.el (org-babel-result-end): use new accessors.

* list/org-exp.el (org-export-mark-list-ending): use new accessors.
2011-02-18 12:45:08 +01:00
Eric Schulte e9cba96b0a ob: fix indentation bug when inserting results from inline code blocks
* lisp/ob.el (org-babel-insert-result): Don't choke if indent is not a number.
2011-02-14 23:51:40 -07:00
Dan Davison 1d1368e142 ob: Maintain in-context text properties when listing search hits in minibuffer
* lisp/ob.el (org-babel-src-block-names): Don't strip text properties from search hits
(org-babel-result-names): Don't strip text properties from search hits
2011-02-13 11:13:32 +00:00
Dan Davison a8f2163d76 ob: `substring' comparison instead of regexp matching
* lisp/ob.el (org-babel-script-escape): Use `substring' comparison
instead of regexp matching

Workaround for regexp limitation, e.g.

(string-match
 "^\\[.+\\]$"
 (concat
  "["
  (mapconcat (lambda (i) "x") (number-sequence 1 33500) "")
  "]"))

gives "Stack overflow in regexp matcher" in several current builds.
2011-02-13 11:03:58 +00:00
Dan Davison 934e6b0510 ob: Allow ":header-arg-name" as matching property name.
* lisp/ob.el (org-babel-params-from-properties): Test for
"header-arg-name" and ":header-arg-name", in that order.
2011-02-12 18:26:10 +00:00
Bastien Guerry 03c33d0d38 Don't wrap org-entry-get into condition-case.
* ob.el (org-babel-params-from-properties): don't wrap
org-entry-get into condition-case.

* org-table.el (org-table-export): don't wrap org-entry-get
into condition-case.

* org.el (org-store-link): don't wrap org-entry-get into
condition-case.
2011-02-12 19:02:52 +01:00
Dan Davison 775d962788 ob: Fix bug in using #+babel properties in fresh buffer
* lisp/ob.el (org-babel-params-from-buffer): Return desired value
rather than nil from failed re search.
2011-02-12 15:29:07 +00:00
Eric Schulte 7b720d28a6 ob: adding no-expand to list of header argument names
* lisp/ob.el (org-babel-header-arg-names): no-expand is now part of
  the default header argument names list.
2011-02-10 09:34:46 -07:00
Eric Schulte 496ea6c527 ob: changing the default header args for inline code blocks 2011-02-04 13:28:51 -07:00
Dan Davison bbb28d5bf8 Get rid of extra help message when editing src code
* lisp/org-src.el (org-edit-src-persistent-message): Change docstring.
(org-edit-src-code): Get rid of help message in echo area.
* lisp/ob.el (org-babel-do-in-edit-buffer): Do not pass 'quietly
argument to org-edit-src-code as this has been removed
2011-02-01 11:44:32 +00:00
Dan Davison 9511f9e153 ob: Allow src block to be executed with point on #+header line
* lisp/ob.el (org-babel-where-is-src-block-head): Detect src block if
point is on a #+header line.
2011-01-31 15:38:49 +00:00
Dan Davison 4a2ed86f6d ob: Don't allow #+header lines to prevent block finding
* lisp/ob.el (org-babel-where-is-src-block-head): Skip over
intervening #+header lines when searching for block associated with
block name line.
2011-01-30 13:07:11 +00:00
Eric Schulte ba0f6d765f ob: safer insertion of results into a list
* lisp/ob.el (org-babel-result-end): Replace call to org-in-item-p to
  the more specific org-at-item-p.
2011-01-29 08:40:57 -07:00
Eric Schulte d0ca215105 ob: simplified code block exportation -- same process for inline and regular blocks
* lisp/ob-exp.el (org-babel-exp-inline-src-blocks): Simplified
  exportation of inline code blocks using normal code block execution
  mechanism to insert results.
  (org-babel-exp-results): Results exportation mechanism is unified
  for both inline and regular code blocks.
* lisp/ob.el (org-babel-where-is-src-block-result): Returns the point
  after an inline code block for inline code blocks.
2011-01-27 12:48:45 -07:00
Eric Schulte 8cca4424a4 ob: better insertion of inline code block results
* lisp/ob.el (org-babel-insert-result): Special handling of the
  position of results of inline code blocks.
  (org-babel-examplize-region): Now able to comment inline regions.
2011-01-27 11:31:47 -07:00
Eric Schulte 39c982eb49 ob: ob-exec-buf and ob-exec-tree now eval inline code blocks as well
* lisp/ob.el (org-babel-map-inline-src-blocks): Macro for executing
  code in each inline code block.
  (org-babel-execute-buffer): Executes inline code blocks as well as
  regular code blocks.
2011-01-25 10:15:47 -07:00
Eric Schulte db0e815a4c ob: fixed issue with ":results replace org"
* lisp/ob.el (org-babel-result-end): Now recognizes "#+begin_org"
  blocks for removal.
2011-01-25 09:15:06 -07:00
Dan Davison 8d00354704 ob: more permissive regexp match for inline src blocks
* lisp/ob.el (org-babel-inline-src-block-regexp): Character preceding
"src_" can now be anything as long as it is neither alphanumeric nor
'-'.
2011-01-21 17:47:51 +00:00
Dan Davison dcfeec887a docstring edits
* lisp/ob.el (org-babel-merge-params): docstring typo
2011-01-20 17:20:19 +00:00
Dan Davison 05ef2ae7cc ob: Allow babel settings to be made in multiple #+babel: lines
* lisp/ob.el (org-babel-params-from-buffer): Process all #+babel:
lines in the buffer
2011-01-20 17:20:18 +00:00
Dan Davison 624141cc68 ob: Make #+header lines override higher-level settings
* lisp/ob.el (org-babel-get-src-block-info): Alter order of merge arguments
2011-01-20 17:20:18 +00:00
Eric Schulte 3d4b884cb3 ob: Ensure all portions of results wrappers end in newlines
* lisp/ob.el (org-babel-insert-result): Ensure all parts of result
  wrappers end in newlines.
2011-01-20 09:30:28 -07:00
Eric Schulte eb3bf55d48 ob: new ":comments noweb" option for wrapping noweb references in comment links
* lisp/ob-tangle.el (org-babel-spec-to-string): Adding "noweb" as a
  linking comment type
  (org-babel-tangle-comment-links): Returns comment links for the
  source code block at point

* lisp/ob.el (org-babel-expand-noweb-references): When :comments is
  set to "noweb" then wrap noweb references in comment links.
2011-01-16 08:21:16 -07:00
Eric Schulte 47537dcda8 ob: allow detangling of text containing '\'s -- Thanks to Seth Burleigh
* lisp/ob.el (org-babel-update-block-body): Literal argument to
  `replace-match' to allow insertion of text containing '\'.
2011-01-13 10:00:39 -07:00
Eric Schulte 1c3ef40f24 ob: fixed bug in org-babel-read-result
Thanks to Leo Alekseyev for bringing this bug to my attention

* lisp/ob.el (org-babel-open-src-block-result): Must collect result
  *before* jumping to the result buffer.
2011-01-11 10:41:35 -07:00
Eric Schulte ea847dcb5f ob: fix small bug in `org-babel-src-block-names'
* lisp/ob.el (org-babel-src-block-names): Fix bug, wrong match-string
  used after update to regexp.
2011-01-11 10:14:13 -07:00
Eric Schulte e72f207c3e ob: ensure that org-babel-temporary-directory is bound before using
* lisp/ob.el (org-babel-temp-file):  Ensure that
  org-babel-temporary-directory is bound before using.
  (org-babel-remove-temporary-directory):  Safer error throwing.
2011-01-09 17:47:45 -07:00
Eric Schulte 8674006516 ob: Uses org-src-lang-modes to resolve language names for evaluation.
* lisp/ob.el (org-babel-execute-src-block): Uses org-src-lang-modes to
  resolve language names for evaluation.
2011-01-07 11:41:15 -07:00
Eric Schulte 1d3db31ca7 ob: better parsing of list output from scripting languages
* lisp/ob.el (org-babel-script-escape): Replace commas with spaces for
  better list reading when list items are packed with commas,
  e.g. Haskell list output.
2010-12-21 20:18:07 -07:00
Eric Schulte ece347e32c org-babel-confirm-evaluate: better doc and code when using function as
Thanks to Vladimir Alexiev for submitting this patch

* lisp/ob.el (org-babel-confirm-evaluate): Fix for the case when
  org-confirm-babel-evaluate is a function (used to always ask no matter
  what the function returns).
* doc/org.texi (Code evaluation security): Add example for using a
  function.
2010-12-21 09:37:19 -07:00
Eric Schulte 4e146a5ac2 ob: a little more refactoring
* lisp/ob.el (org-babel-execute-src-block): Removed unused flet function.
2010-12-21 14:19:25 +00:00
Dan Davison 366abc6175 ob: Refactoring
* lisp/ob.el (org-babel-format-result): New function to format results
of src block execution.
(org-babel-execute-src-block): Use `org-babel-format-result' when
writing to file.
(org-babel-open-src-block-result): Use `org-babel-format-result' when
displaying results in a buffer; name results buffer differently.
2010-12-21 14:19:24 +00:00
Dan Davison 70349cd0c2 ob: Bug fix in writing results to file
* lisp/ob.el (org-babel-execute-src-block): Avoid calling
`orgtbl-to-generic' on number results
2010-12-21 14:19:24 +00:00
Eric Schulte e0b7927678 ob: :sep specifies table separator when opening or writing tabular results
* lisp/ob.el (org-babel-execute-src-block): Allow specification of
  table separator with :sep header argument.
  (org-babel-open-src-block-result): Allow specification of table
  separator with :sep header argument.
2010-12-21 14:19:24 +00:00
Dan Davison 74d752b4b5 ob: Wipe error buffer before executing buffer/subtree
* lisp/ob.el (org-babel-execute-buffer): Wipe error buffer at outset
of executing buffer (note that this handles execute subtree also).
2010-12-21 11:06:35 +00:00
Dan Davison a871c6a77c new :results behavior 2010-12-20 16:44:24 +00:00
Dan Davison d6fefb406e babel: Interpret string results as file links with :results file
* lisp/ob.el (org-babel-execute-src-block): With :results file, when
:file is not supplied, interpret result as a file link as long as it
is a string.
2010-12-19 14:25:18 +00:00
Eric Schulte f5f2851401 Noweb references can now be resolved from the library of babel.
* lisp/ob.el (org-babel-expand-noweb-references): Noweb references can
  now be resolved from the library of babel.
2010-12-15 10:16:58 -07:00
Eric Schulte e919c97d7e fixed insertion of trailing newline after code block evaluation
* lisp/ob.el (org-babel-result-end): No longer leaving trailing new
  line after block removal.
2010-12-15 09:58:57 -07:00
Achim Gratz 8dfd6a6140 Fixup 95bb16661b
* org.el: remove spurious linebreak introduced by earlier patch
* ob.el, ob-ref.el: remove double fix of the same problem

Achim Gratz <Stromeko@Stromeko.DE> wrote:

> this patch had already been partially applied by Carsten and Eric (in
> slightly a different way than I suggested).  The changes to ob.el and
> ob-ref.el (the require statements) are therefore superfluous and should
> probably be backed out.  There was also a superfluous whitespace change
> in org.el (a closing paren that was broken onto the next line).  Patch
> to this effect is attached.  You've already cleaned up org-agenda.el and
> the conditions in org-macs...
2010-12-12 20:09:28 +01:00
Carsten Dominik 7666ba421f Version number back to 7.4 2010-12-10 18:49:40 +01:00
Carsten Dominik 76a25715c9 Bump version number to 7.5 2010-12-10 18:43:10 +01:00
Dan Davison c6a945e82c babel: Handle errors when temporary directory is on a different partition
* lisp/ob.el (org-babel-remove-temporary-directory): Handle exception
  with message informing of failure to remove directory.

Thanks to Antti Kaihola for the bug report:

http://thread.gmane.org/gmane.emacs.orgmode/34394

From: Antti Kaihola <akaihola <at> gmail.com>
Subject: Can't close Emacs+org-mode if /tmp and /home on different	partitions
Newsgroups: gmane.emacs.orgmode
Date: 2010-12-02 08:33:28 GMT (6 days, 1 hour and 22 minutes ago)
I have /tmp on my root partition and a separate partition for /home.
When trying to close an Emacs session which is using org-mode, I get
this error:

    move-file-to-trash: Non-regular file: Is a directory, /tmp/babel-XXXXXXX

(where XXXXXXX are random characters).

I tracked down the problem to org-babel-remove-temporary-directory
which ob.el adds to kill-emacs-hook. It tries to remove the temporary
directory using delete-directory, which in turn tries to move the
directory (by renaming) into trash, which is in my home directory.

I added this to my ~/.emacs.d/init.el:

   (custom-set-variables '(temporary-file-directory "/home/akaihola/tmp/"))

and closing Emacs works correctly again. However, since my init.el is
part of emacs-starter-kit which I update frequently, I'd prefer not to
modify that file. Unfortunately the customization hook
emacs-starter-kit provides (~/.emacs.d/custom.el) is loaded too late
to affect the temporary directory.

I'm running emacs-snapshot 1:20090909-1 in Ubuntu 10.10. Looks like
this is really an Emacs bug and is already fixed:
http://groups.google.com/group/gnu.emacs.bug/browse_thread/thread/0446b8684a8ef504
2010-12-08 10:11:49 +00:00
Eric Schulte 1ce04c5057 updating Code block evaluation messages
Thanks to Sébastien Vauban for suggesting these changes.

* lisp/ob.el (org-babel-insert-result): More informative code block
  evaluation messages.
2010-12-06 08:04:17 -07:00
Eric Schulte 201eb8ce23 ob: examplization of inserted results is smarter about markers
* lisp/ob.el (org-babel-examplize-region): Check if `end' is a marker
  or a point and handle appropriately.
2010-12-03 07:11:09 -07:00
Eric Schulte a9a77780dc change requirement order to ob-eval is always loaded
* lisp/ob-eval.el (require): No longer require ob.el to allow
  requiring by ob.el.
* lisp/ob.el (ob-eval): Require ob-eval.
2010-12-01 07:19:45 -07:00
Eric Schulte 232651a57e ob: mention code block name when ":eval query"
* lisp/ob.el (org-babel-confirm-evaluate): Show code block's name when
  it is available during evaluation query.
2010-11-30 22:02:02 -07:00
Eric Schulte c4418fc472 ob: fixed insertion of result error
* lisp/ob.el (org-babel-insert-result): Using markers instead of
  points for more robust buffer anchors.
2010-11-30 19:22:34 -07:00
Eric Schulte c3b7eca193 ob: fixed newly introduced empty result error
* lisp/ob.el (org-babel-examplize-region): Remove old assertion which
  no longer applies to the result insertion code.
2010-11-27 17:51:46 -07:00
Eric Schulte 01b4f63fe9 ob: no longer escaping results which will be wrapped in a block.
* lisp/ob.el (org-babel-insert-result): No longer escape results which
  will be wrapped in a block.
2010-11-26 15:48:22 -07:00
Eric Schulte 30b2d604c5 ob: more descriptive "Evaluation Aborted" message
* lisp/ob.el (org-babel-confirm-evaluate): More descriptive message
  when evaluation is aborted or disabled.
2010-11-25 10:28:04 -07:00
Eric Schulte b5f7b02814 "wrap" :results header argument wraps code block results
* lisp/ob.el (org-babel-insert-result): Responds to new "wrap" header
  argument.
  (org-babel-merge-params): Includes new "wrap" header argument in
  one of the results header argument exclusive groups.

* lisp/org.el (org-additional-option-like-keywords): Fontify begin and
  and results lines as comments.
2010-11-24 10:19:44 -07:00
Eric Schulte 950bea36f8 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2010-11-23 09:39:41 -07:00
Eric Schulte d24b04d82f ob: cleaner parsing of header arguments
Thanks to Charles C. Berry for insisting on this issues existence

  This change is now secured with a unit test

* lisp/ob.el (org-babel-parse-header-arguments): Stripping trailing
  spaces off of header arguments (even the first one).
2010-11-23 09:39:26 -07:00
Dan Davison 666e6ed5e7 babel: Wipe error buffer clean at start of execution
* lisp/ob-eval.el (org-babel-error-buffer-name): Define new variable.

  (org-babel-eval-error-notify): Use new variable `org-babel-error-buffer-name'
  (org-babel-eval): Make temp error buffer invisible to the user with
		    initial space in name.
  (org-babel-eval-wipe-error-buffer): New function to wipe the error message buffer.

* lisp/ob-exp.el (org-babel-eval-wipe-error-buffer): Declare external function
  `org-babel-eval-wipe-error-buffer'.
  (org-babel-exp-results): Wipe error buffer clean at outset of execution

* lisp/ob.el (org-babel-execute-src-block-maybe): Wipe error buffer clean at
  outset of execution
  (org-babel-eval-wipe-error-buffer): Declare external function
				    `org-babel-eval-wipe-error-buffer'.
2010-11-23 13:26:31 +00:00
Eric Schulte b174975eb7 ob: safer conversion of results of scripting languages into elisp objects
* lisp/ob-python.el (org-babel-python-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob-ruby.el (org-babel-ruby-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob.el (org-babel-script-escape): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.

* lisp/ob-haskell.el (org-babel-haskell-table-or-string): Using
  `org-babel-script-escape' for reading string input from scripting
  languages.
2010-11-22 18:51:00 -07:00
Achim Gratz 95bb16661b Fix byte compiler warnings
* org-macs.el (org-called-interactively-p): Wrap function call in
	with-no-warnings.
	(with-silent-modifications) Declare macro for Emacs < 23.2.

TINYCHANGE
2010-11-22 21:22:27 +01:00
Eric Schulte 3785722e92 ob: fix compiler warnings introduced by code-block list reading/writing 2010-11-22 07:21:18 -07:00
Eric Schulte 6baa78b2da ob: no longer adding extra ":" to singleton first header args
* lisp/ob.el (org-babel-parse-header-arguments): Removed addition of
  ":" to singleton first header arguments as it was leading to errors.
2010-11-22 06:44:06 -07:00
Eric Schulte 451acd11ce move ob-map-src-blocks up in ob.el and autoload it
* lisp/ob.el (org-babel-map-src-blocks): Moved to earlier in the file
  and now autoloading.
2010-11-19 01:16:29 -07:00
Eric Schulte e34033fec2 using higher level function for checking list membership
Thanks to Nicolas Goaziou for pointing this out

* lisp/ob-ref.el (org-babel-ref-at-ref-p): Use higher level function
  for testing list membership.
* lisp/ob.el (org-babel-read-result): Use higher level function for
  testing list membership.
  (org-babel-result-end): Use higher level function for testing list
  membership.
2010-11-18 09:34:21 -07:00
Eric Schulte 97f4c3f9a1 fixed (hopefully) error in compiled form of org-babel-map-src-blocks
* lisp/ob.el (org-babel-map-src-blocks): Ensure that the file argument
  is only evaluated once.
2010-11-17 17:03:44 -07:00