From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [RFC] Standardized code block keywords Date: Fri, 28 Oct 2011 10:49:04 -0600 Message-ID: <87pqhhqcxr.fsf@gmail.com> References: <87pqhrih3s.fsf@gmail.com> <201110261641.21161.DanielBausch@gmx.de> <6009.1319641493@alphaville.dokosmarshall.org> <201110270725.38634.DanielBausch@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:55785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJpcJ-0007PJ-47 for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 12:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJpcF-0008HK-Un for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 12:49:15 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:49473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJpcF-0008HF-NP for emacs-orgmode@gnu.org; Fri, 28 Oct 2011 12:49:11 -0400 Received: by vws16 with SMTP id 16so4382045vws.0 for ; Fri, 28 Oct 2011 09:49:11 -0700 (PDT) In-Reply-To: <201110270725.38634.DanielBausch@gmx.de> (Daniel Bausch's message of "Thu, 27 Oct 2011 07:25:38 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Bausch Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain The attached patch implements these changes, please see the patch comment as it contains all of the pertinent information. If any brave volunteers would be willing to test this patch locally before I apply it to the Org-mode git repository that would be greatly appreciated. Thanks to the test suite the most egregious bugs introduced by my first version of this patch have already been caught and fixed. Cheers -- Eric --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-removing-code-block-results-and-call-line-synonyms-B.patch >From a708aced9e29504637ac1d2ce3203fb796081a7e Mon Sep 17 00:00:00 2001 From: Eric Schulte 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. --- contrib/babel/library-of-babel.org | 48 +++++++++++++++++----------------- lisp/ob-exp.el | 2 +- lisp/ob-lob.el | 13 +-------- lisp/ob-ref.el | 4 +++ lisp/ob-table.el | 2 +- lisp/ob.el | 30 ++++++++++++--------- lisp/org.el | 9 ++---- testing/examples/babel-dangerous.org | 5 +++- testing/examples/babel.org | 30 ++++++++++---------- testing/examples/ob-awk-test.org | 4 +- testing/examples/ob-fortran-test.org | 4 +- testing/lisp/test-ob.el | 42 ----------------------------- 12 files changed, 75 insertions(+), 118 deletions(-) diff --git a/contrib/babel/library-of-babel.org b/contrib/babel/library-of-babel.org index 2db9d4c..571eb70 100644 --- a/contrib/babel/library-of-babel.org +++ b/contrib/babel/library-of-babel.org @@ -22,7 +22,7 @@ A collection of simple utility functions: -#+srcname: echo +#+name: echo #+begin_src emacs-lisp :var input="echo'd" input #+end_src @@ -35,7 +35,7 @@ Read the contents of the file at =file=. The =:results vector= and =:results scalar= header arguments can be used to read the contents of file as either a table or a string. -#+srcname: read +#+name: read #+begin_src emacs-lisp :var file="" :var format="" (if (string= format "csv") (with-temp-buffer @@ -49,7 +49,7 @@ file as either a table or a string. Write =data= to a file at =file=. If =data= is a list, then write it as a table in traditional Org-mode table syntax. -#+srcname: write +#+name: write #+begin_src emacs-lisp :var data="" :var file="" :var ext='() (flet ((echo (r) (if (stringp r) r (format "%S" r)))) (with-temp-file file @@ -67,7 +67,7 @@ as a table in traditional Org-mode table syntax. Read local or remote file in [[http://www.json.org/][json]] format into emacs-lisp objects. -#+srcname: json +#+name: json #+begin_src emacs-lisp :var file='() :var url='() (require 'json) (cond @@ -96,7 +96,7 @@ The =google= command seems to be throwing "Moved Temporarily" errors when trying to download textual documents, but this is working fine for spreadsheets. -#+source: gdoc-read +#+name: gdoc-read #+begin_src emacs-lisp :var title="example" :var format="csv" (let* ((file (concat title "." format)) (cmd (format "google docs get --format %S --title %S" format title))) @@ -126,7 +126,7 @@ Write =data= to a google document named =title=. If =data= is tabular it will be saved to a spreadsheet, otherwise it will be saved as a normal document. -#+source: gdoc-write +#+name: gdoc-write #+begin_src emacs-lisp :var title="babel-upload" :var data=fibs(n=10) :results silent (let* ((format (if (listp data) "csv" "txt")) (tmp-file (make-temp-file "org-babel-google-doc" nil (concat "." format))) @@ -157,7 +157,7 @@ example usage Plot column 2 (y axis) against column 1 (x axis). Columns 3 and beyond, if present, are ignored. -#+srcname: R-plot(data=R-plot-example-data) +#+name: R-plot(data=R-plot-example-data) #+begin_src R plot(data) #+end_src @@ -169,7 +169,7 @@ plot(data) | 4 | 16 | | 5 | 25 | -#+lob: R-plot(data=R-plot-example-data) +#+call: R-plot(data=R-plot-example-data) #+resname: R-plot(data=R-plot-example-data) : nil @@ -180,7 +180,7 @@ plot(data) ** Headline references -#+source: headline +#+name: headline #+begin_src emacs-lisp :var headline=top :var file='() (save-excursion (when file (get-file-buffer file)) @@ -217,7 +217,7 @@ optional. | env | optional environment, default to "tabular" | | width | optional width specification string | -#+srcname: booktabs +#+name: booktabs #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var align='() :var env="tabular" :var width='() :noweb yes :results latex (flet ((to-tab (tab) (orgtbl-to-generic @@ -266,7 +266,7 @@ are optional. | foot | optional "foot" string | | lastfoot | optional "lastfoot" string | -#+srcname: longtable +#+name: longtable #+begin_src emacs-lisp :var table='((:table)) :var align='() :var width='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex (org-fill-template " @@ -314,7 +314,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. #+tblname: arguments-notes | \multicolumn{2}{l}{This is a footnote to the \emph{arguments} table.} | -#+srcname: booktabs-notes +#+name: booktabs-notes #+begin_src emacs-lisp :var table='((:head) hline (:body)) :var notes='() :var align='() :var env="tabular" :var width='() :var lspace='() :noweb yes :results latex (flet ((to-tab (tab) (orgtbl-to-generic @@ -356,7 +356,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. | 1 | 2 | 3 | | 4 | 5 | 6 | -#+srcname: transpose +#+name: transpose #+begin_src emacs-lisp :var table=transpose-example (apply #'mapcar* #'list table) #+end_src @@ -372,7 +372,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. | 1 | 2 | 3 | | a | b | c | -#+source: all-to-string +#+name: all-to-string #+begin_src emacs-lisp :var tbl='() (defun all-to-string (tbl) (if (listp tbl) @@ -387,7 +387,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl) #+end_src -#+results: +#+name: | nil | nil | nil | | t | t | t | @@ -395,7 +395,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. (mapcar (lambda (row) (mapcar (lambda (cell) (stringp cell)) row)) tbl) #+end_src -#+results: +#+name: | t | t | t | | t | t | t | @@ -412,7 +412,7 @@ export. The function uses the Emacs VC commands to interface to the local version control system, but has only been tested to work with Git. 'limit' is currently unsupported. -#+source: vc-log +#+name: vc-log #+headers: :var limit=-1 #+headers: :var buf=(buffer-name (current-buffer)) #+begin_src emacs-lisp @@ -440,34 +440,34 @@ Git. 'limit' is currently unsupported. ** Trivial python code blocks -#+srcname: python-identity(a=1) +#+name: python-identity(a=1) #+begin_src python a #+end_src -#+srcname: python-add(a=1, b=2) +#+name: python-add(a=1, b=2) #+begin_src python a + b #+end_src ** Arithmetic -#+source: lob-add +#+name: lob-add #+begin_src emacs-lisp :var a=0 :var b=0 (+ a b) #+end_src -#+source: lob-minus +#+name: lob-minus #+begin_src emacs-lisp :var a=0 :var b=0 (- a b) #+end_src -#+source: lob-times +#+name: lob-times #+begin_src emacs-lisp :var a=0 :var b=0 (* a b) #+end_src -#+source: lob-div +#+name: lob-div #+begin_src emacs-lisp :var a=0 :var b=0 (/ a b) #+end_src @@ -477,7 +477,7 @@ a + b The =elispgantt= source block was sent to the mailing list by Eric Fraga. It was modified slightly by Tom Dye. -#+source: elispgantt +#+name: elispgantt #+begin_src emacs-lisp :var table=gantttest (let ((dates "") (entries (nthcdr 2 table)) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 3b102e1..e4fae80 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -147,7 +147,7 @@ options and are taken from `org-babel-default-inline-header-args'." (forward-char 2))))))))) (defun org-exp-res/src-name-cleanup () - "Clean up #+results and #+srcname lines for export. + "Clean up #+results and #+name lines for export. This function should only be called after all block processing has taken place." (interactive) diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index be3033e..73f9553 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -61,24 +61,15 @@ To add files to this list use the `org-babel-lob-ingest' command." lob-ingest-count (if (> lob-ingest-count 1) "s" "")) lob-ingest-count)) -(defconst org-babel-lob-call-aliases '("lob" "call") - "Aliases to call a source block function. -If you change the value of this variable then your files may - become unusable by other org-babel users, and vice versa.") - (defconst org-babel-block-lob-one-liner-regexp (concat - "^\\([ \t]*\\)#\\+\\(?:" - (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") - "\\):[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" + "^\\([ \t]*\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?") "Regexp to match non-inline calls to predefined source block functions.") (defconst org-babel-inline-lob-one-liner-regexp (concat - "\\([^\n]*\\)\\(?:" - (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") - "\\)_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" + "\\([^\n]*\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" "\(\\([^\n]*\\)\)\\(\\[\\(.*?\\)\\]\\)?") "Regexp to match inline calls to predefined source block functions.") diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index bff3b3f..fcaeba0 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -173,6 +173,10 @@ the variable." (cond (lob-info (setq type 'lob)) (id (setq type 'id)) + ((and (looking-at org-babel-src-name-regexp) + (progn (forward-line 1) + (looking-at org-babel-src-block-regexp))) + (setq type 'source-block)) (t (while (not (setq type (org-babel-ref-at-ref-p))) (forward-line 1) (beginning-of-line) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index 1cee16e..15ebff9 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -30,7 +30,7 @@ ;; (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2))))) ;; #+end_src -;; #+srcname: fibbd +;; #+name: fibbd ;; #+begin_src emacs-lisp :var n=2 :results silent ;; (fibbd n) ;; #+end_src diff --git a/lisp/ob.el b/lisp/ob.el index 4438ee8..5d52f95 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -113,7 +113,7 @@ remove code block execution from the C-c C-c keybinding." :type 'boolean) (defvar org-babel-src-name-regexp - "^[ \t]*#\\+\\(srcname\\|source\\|function\\):[ \t]*" + "^[ \t]*#\\+name:[ \t]*" "Regular expression used to match a source name line.") (defvar org-babel-multi-line-header-regexp @@ -216,8 +216,8 @@ Returns a list (nth 2 info) (org-babel-parse-header-arguments (match-string 1))))) (when (looking-at org-babel-src-name-w-name-regexp) - (setq name (org-babel-clean-text-properties (match-string 4))) - (when (match-string 6) + (setq name (org-babel-clean-text-properties (match-string 3))) + (when (match-string 5) (setf (nth 2 info) ;; merge functional-syntax vars and header-args (org-babel-merge-params (mapcar @@ -229,7 +229,7 @@ Returns a list (error "variable \"%s\"%s must be assigned a default value" var (if name (format " in block \"%s\"" name) "")))) - (org-babel-ref-split-args (match-string 6)))) + (org-babel-ref-split-args (match-string 5)))) (nth 2 info)))))) ;; inline source block (when (org-babel-get-inline-src-block-matches) @@ -396,7 +396,7 @@ specific header arguments as well.") '((:session . "none") (:results . "replace") (:exports . "results")) "Default arguments to use when evaluating an inline source block.") -(defvar org-babel-data-names '("TBLNAME" "RESNAME" "RESULTS" "DATA")) +(defvar org-babel-data-names '("TBLNAME" "RESULTS" "NAME")) (defvar org-babel-result-regexp (concat "^[ \t]*#\\+" @@ -1359,7 +1359,7 @@ org-babel-named-src-block-regexp." (regexp (org-babel-named-src-block-regexp-for-name name)) msg) (goto-char (point-min)) (when (or (re-search-forward regexp nil t) - (re-search-backward regexp nil t)) + (re-search-backward regexp nil t)) (match-beginning 0))))) (defun org-babel-src-block-names (&optional file) @@ -1368,7 +1368,7 @@ org-babel-named-src-block-regexp." (when file (find-file file)) (goto-char (point-min)) (let (names) (while (re-search-forward org-babel-src-name-w-name-regexp nil t) - (setq names (cons (match-string 4) names))) + (setq names (cons (match-string 3) names))) names))) ;;;###autoload @@ -1384,16 +1384,20 @@ org-babel-named-src-block-regexp." (progn (goto-char point) (org-show-context)) (message "result '%s' not found in this buffer" name)))) -(defun org-babel-find-named-result (name) +(defun org-babel-find-named-result (name &optional point) "Find a named result. Return the location of the result named NAME in the current buffer or nil if no such result exists." (save-excursion - (goto-char (point-min)) - (when (re-search-forward - (concat org-babel-result-regexp - "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) - (beginning-of-line 0) (point)))) + (goto-char (or point (point-min))) + (catch 'is-a-code-block + (when (re-search-forward + (concat org-babel-result-regexp + "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) + (when (and (string= "name" (match-string 1)) + (looking-at org-babel-src-block-regexp)) + (throw 'is-a-code-block (org-babel-find-named-result name (point)))) + (beginning-of-line 0) (point))))) (defun org-babel-result-names (&optional file) "Returns the names of results in FILE or the current buffer." diff --git a/lisp/org.el b/lisp/org.el index 2599d41..e23242e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5400,9 +5400,8 @@ will be prompted for." '(font-lock-fontified t face org-meta-line)) t) ((or (member dc1 '("begin:" "end:" "caption:" "label:" - "orgtbl:" "tblfm:" "tblname:" "result:" - "results:" "source:" "srcname:" "call:" - "data:" "header:" "headers:")) + "orgtbl:" "tblfm:" "tblname:" "results:" + "call:" "header:" "headers:")) (and (match-end 4) (equal dc3 "attr"))) (add-text-properties beg (match-end 0) @@ -10966,10 +10965,8 @@ This function can be used in a hook." "BEGIN_CENTER" "END_CENTER" "BEGIN_SRC" "END_SRC" "BEGIN_RESULT" "END_RESULT" - "SOURCE:" "SRCNAME:" "FUNCTION:" - "RESULTS:" "DATA:" + "NAME:" "RESULTS:" "HEADER:" "HEADERS:" - "BABEL:" "CATEGORY:" "COLUMNS:" "PROPERTY:" "CAPTION:" "LABEL:" "SETUPFILE:" diff --git a/testing/examples/babel-dangerous.org b/testing/examples/babel-dangerous.org index 63f9f27..8ec9fa6 100644 --- a/testing/examples/babel-dangerous.org +++ b/testing/examples/babel-dangerous.org @@ -9,7 +9,10 @@ There is no default value assigned to =x= variable. This is not permitted anymore. -#+source: carre(x) +#+name: carre(x) #+begin_src python return x*x #+end_src + +#+name: carre + diff --git a/testing/examples/babel.org b/testing/examples/babel.org index 9c61b0c..45d0171 100644 --- a/testing/examples/babel.org +++ b/testing/examples/babel.org @@ -6,7 +6,7 @@ :ID: eb1f6498-5bd9-45e0-9c56-50717053e7b7 :END: -#+source: noweb-example +#+name: noweb-example #+begin_src emacs-lisp (message "expanded") #+end_src @@ -39,7 +39,7 @@ prop #+end_src -#+results: +#+name: : 4 * excessive id links on tangling @@ -64,7 +64,7 @@ :ID: f68821bc-7f49-4389-85b5-914791ee3718 :END: -#+source: four +#+name: four #+begin_src emacs-lisp (list 1 2 3 4) #+end_src @@ -73,7 +73,7 @@ (length four) #+end_src -#+results: +#+name: : 4 * multi-line header arguments @@ -86,7 +86,7 @@ (map 'list #'list numbers letters) #+end_src -#+results: +#+name: | 1 | a | | 2 | b | | 3 | c | @@ -100,15 +100,15 @@ :ID: 0d82b52d-1bb9-4916-816b-2c67c8108dbb :END: -#+source: i-have-a-name +#+name: i-have-a-name #+begin_src emacs-lisp 42 #+end_src -#+results: +#+name: : 42 -#+results: i-have-a-name +#+name: i-have-a-name : 42 * Pascal's Triangle -- export test @@ -116,7 +116,7 @@ :ID: 92518f2a-a46a-4205-a3ab-bcce1008a4bb :END: -#+source: pascals-triangle +#+name: pascals-triangle #+begin_src emacs-lisp :var n=5 :exports both (defun pascals-triangle (n) (if (= n 0) @@ -136,7 +136,7 @@ :ID: 6d2ff4ce-4489-4e2a-9c65-e3f71f77d975 :END: -#+source: take-sqrt +#+name: take-sqrt #+begin_src emacs-lisp :var n=9 (sqrt n) #+end_src @@ -159,7 +159,7 @@ This is an inline call call_echo(input="testing")[:results vector] embedded in p call_echo("testing") call_concat(1,2,3) -#+source: concat +#+name: concat #+begin_src emacs-lisp :var a=0 :var b=0 :var c=0 (format "%S%S%S" a b c) #+end_src @@ -169,7 +169,7 @@ call_concat(1,2,3) :ID: 72ddeed3-2d17-4c7f-8192-a575d535d3fc :END: -#+source: double +#+name: double #+begin_src emacs-lisp :var it=0 (* 2 it) #+end_src @@ -214,7 +214,7 @@ src_sh{echo 3} Here is one at the beginning of a line. :PROPERTIES: :ID: 5daa4d03-e3ea-46b7-b093-62c1b7632df3 :END: -#+results: a-list +#+name: a-list - a - b - c @@ -298,13 +298,13 @@ src_sh{echo 2} blocks on the src_emacs-lisp{"same"} line echo "[[file:./cv.cls]]" #+end_src -#+results: +#+name: : [[file:./cv.cls]] #+begin_src sh :results raw scalar echo "[[file:./cv.cls]]" #+end_src -#+results: +#+name: [[file:./cv.cls]] diff --git a/testing/examples/ob-awk-test.org b/testing/examples/ob-awk-test.org index 7f51772..9a33bf8 100644 --- a/testing/examples/ob-awk-test.org +++ b/testing/examples/ob-awk-test.org @@ -20,7 +20,7 @@ Use a code block ouput as an input #+end_src Use input file -#+srcname: genfile +#+name: genfile #+begin_src awk :in-file ob-awk-test.in :results silent $0~/[\t]*#/{ # skip comments @@ -33,7 +33,7 @@ Use input file * Input data generators A code block to generate input stream -#+srcname: genseq +#+name: genseq #+begin_src emacs-lisp :results silent (print "1") #+end_src diff --git a/testing/examples/ob-fortran-test.org b/testing/examples/ob-fortran-test.org index d48ae4e..47931bf 100644 --- a/testing/examples/ob-fortran-test.org +++ b/testing/examples/ob-fortran-test.org @@ -5,12 +5,12 @@ :PROPERTIES: :ID: 459384e8-1797-4f11-867e-dde0473ea7cc :END: -#+source: hello +#+name: hello #+begin_src fortran :results silent print *, 'Hello world' #+end_src -#+source: fortran_parameter +#+name: fortran_parameter #+begin_src fortran :results silent integer, parameter :: i = 10 write (*, '(i2)') i diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 58ff756..738df52 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -13,36 +13,6 @@ (require 'org-test) (require 'org-test-ob-consts)) -(ert-deftest test-org-babel/src-name-regexp () - (should(equal "^[ \t]*#\\+\\(srcname\\|source\\|function\\):[ \t]*" - org-babel-src-name-regexp)) - (mapcar (lambda (name) - (should (org-test-string-exact-match - org-babel-src-name-regexp - (concat - " \t #+" - name - ": \t src-name \t blah blah blah "))) - (should (string-match - org-babel-src-name-regexp - (concat - "#+" (upcase name) - ": src-name"))) - ;;TODO This should fail no? - (should (org-test-string-exact-match - org-babel-src-name-regexp - (concat - "#+" name ":"))) - ;;TODO Check - should this pass? - (should (not (org-test-string-exact-match - org-babel-src-name-regexp - (concat - "#+" name " : src-name"))))) - '("srcname" "source" "function")) - (should (not (org-test-string-exact-match - org-babel-src-name-regexp - "#+invalid-name: src-name")))) - (ert-deftest test-org-babel/multi-line-header-regexp () (should(equal "^[ \t]*#\\+headers?:[ \t]*\\([^\n]*\\)$" org-babel-multi-line-header-regexp)) @@ -63,18 +33,6 @@ org-babel-multi-line-header-regexp " \t #+headers : blah1 blah2 blah3 \t\n\t\n blah4 blah5 blah6 \n")))) -(ert-deftest test-org-babel/src-name-w-name-regexp () - (should(equal - (concat org-babel-src-name-regexp "\\(" - org-babel-multi-line-header-regexp "\\)*" - "\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)") - org-babel-src-name-w-name-regexp)) - (should (org-test-string-exact-match - org-babel-src-name-w-name-regexp - (concat - "#+srcname: src-name " - "#+headers: blah1 blah2 blah3 \t\n\t\n blah4 blah5 blah6 \n")))) - (ert-deftest test-org-babel/src-block-regexp () (let ((test-block (concat -- 1.7.4.1 --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte/ --=-=-=--