Commit Graph

24 Commits

Author SHA1 Message Date
Sebastien Vauban 2d78957c5c Fix old Babel syntax 2012-02-18 09:15:44 -07:00
Sebastien Vauban 8e1eeaa190 Fix old-way variable assignments. 2011-12-26 14:42:22 +01: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 1b676bcd0f new lob function to convert every element of a table to a string
* contrib/babel/library-of-babel.org (Write): Convert every element of
  a table to a string.
2011-08-29 12:01:38 -06:00
Tom Dye 9e52be7253 * contrib/babel/library-of-babel.org: 2011-08-28 Thomas Dye <tsd@tsdye.com>
* Add booktabs-notes source block to the Library of Babel.  Minor
	edits to booktabs documentation.
2011-08-28 12:00:13 -06:00
Bastien Guerry 57dd93f8ea contrib/babel/library-of-babel.org: Added languages section. 2011-07-08 16:38:52 +02:00
Eric Schulte 90512366cd adding some basic arithmetic to the library of babel 2011-06-25 15:11:08 -07:00
Eric Schulte 0e3a8100f3 library-of-babel: adding vc-log by Luke Crook 2011-03-31 18:32:00 -06:00
Eric Schulte a9c5797fa1 library of babel: aesthetic changes to elispgantt 2010-11-12 16:37:17 -07:00
Eric Schulte 2ae5721731 adding elispgantt to the library of babel
The =elispgantt= source block was sent to the mailing list by Eric
  Fraga.  It was modified slightly by Tom Dye.
2010-11-12 16:34:46 -07:00
Eric Schulte b5967dfa88 library of babel: new code block for expanding headings
* contrib/babel/library-of-babel.org (Write): new code block for
  expanding headings
2010-09-21 09:49:41 -06:00
Eric Schulte 25ac9ea8dd library-of-babel: more control over exporting results to files
#+source: table
  #+begin_src emacs-lisp
    (mapcar
     (lambda (el) (number-sequence el (+ el 3)))
     (number-sequence 0 4))
  #+end_src

  writes the results out as csv file
  #+call: write(data=table, file="~/Desktop/example.csv") :results silent

  writes the results out as tab separated file
  #+call: write(data=table, file="~/Desktop/example.tsv") :results silent

  write the results out as a normal org-mode file
  #+call: write(data=table, file="~/Desktop/example.org") :results silent

* contrib/babel/library-of-babel.org: more control over exporting
  results to files
2010-08-08 22:23:53 -06:00
Eric Schulte 15ca30bc86 library-of-babel: improving reading text/tables in from files
* contrib/babel/library-of-babel.org(read): adding explicit format
  argument

  (gdoc-read): explicit format argument, and passing the csv
  specification through to org-table-import

  also removing org example code blocks
2010-07-20 11:49:55 -07:00
Eric Schulte d6208a7fe5 library-of-babel: more flexible reading of files into elisp 2010-07-19 17:13:53 -07:00
Eric Schulte a618566cd6 library of babel: support for reading/writing to/from Google docs 2010-07-19 17:12:53 -07:00
Eric Schulte e0f0e26a43 library-of-babel: adding a booktabs latex exporting function 2010-06-30 11:53:10 -07:00
Eric Schulte 96961abd3b library-of-babel: back to a single function per table environment 2010-06-28 13:23:48 -07:00
Eric Schulte 5461d3e605 library-of-babel: adding function for LaTeX Table export
* contrib/babel/library-of-babel.org (Write): support for LaTeX table export
2010-06-28 10:08:52 -07:00
Eric Schulte 517837b3a1 library of babel: added json function for accessing local or remote json objects
A quick example of accessing remote json data from Babel code blocks.

  Evaluate the following to see a listing of parks in DC by ward.

  #+source: dc-parks
  #+begin_src emacs-lisp :var keys='(ward address) :var data=json(url="http://ogdi.cloudapp.net/v1/dc/RecreationParks?format=json")
    (append
     (list keys 'hline)
     (mapcar
      (lambda (lis) (mapcar (lambda (key) (cdr (assoc key lis))) keys))
      (cdr (car data))))
  #+end_src
2010-06-27 16:07:29 -07:00
Eric Schulte 799c15ffaf babel: adding simple "echo" function to library-of-babel 2010-06-09 21:03:21 -07:00
Eric Schulte 4e43e7fea8 babel: adding library-of-babel functions for file I/O
* contrib/babel/lisp/org-babel.el (org-babel-insert-result): Replaced
  call to `org-cycle' with a call to the simpler and more appropriate
  `org-table-align'.

* contrib/babel/library-of-babel.org (Read/Write): adding
  library-of-babel functions for file I/O
2010-06-06 19:56:09 -07:00
Eric Schulte dacd052bef brought in latest library-of-babel.org from worg 2009-09-13 21:15:17 -06:00
Eric Schulte eec9c235d0 moving/removing files, and updating paths 2009-09-11 13:56:14 -06:00
Eric Schulte c0554c7753 merging with the org-babel repository 2009-09-11 13:44:05 -06:00