Standardized code block keywords
commit7e93b90f8816346a16ad49cee22870b17c05b211
authorEric Schulte <schulte.eric@gmail.com>
Fri, 28 Oct 2011 23:52:48 +0000 (28 23:52 +0000)
committerEric Schulte <schulte.eric@gmail.com>
Tue, 15 Nov 2011 15:56:24 +0000 (15 08:56 -0700)
tree3af6bdb5a2e8edbfe2413d1762888c42a88521a8
parentb43c1c621f52f4a51d8d79cb76c226dfed003998
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.
12 files changed:
contrib/babel/library-of-babel.org
lisp/ob-exp.el
lisp/ob-lob.el
lisp/ob-ref.el
lisp/ob-table.el
lisp/ob.el
lisp/org.el
testing/examples/babel-dangerous.org
testing/examples/babel.org
testing/examples/ob-awk-test.org
testing/examples/ob-fortran-test.org
testing/lisp/test-ob.el