Remove deprecated syntax for Babel properties

* doc/org.texi (Header arguments in Org mode properties): Remove
  reference to deprecated syntax.
* lisp/ob-core.el (org-babel-params-from-properties): Ignore deprecated
  syntax.
* testing/examples/babel.org:
* testing/examples/normal.org:
* testing/examples/ob-header-arg-defaults.org:
* testing/examples/property-inheritance.org:
* testing/lisp/test-ob-header-arg-defaults.el
(test-ob-header-arg-defaults/global/noweb):
(test-ob-header-arg-defaults/global/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
(test-ob-header-arg-defaults/tree/overwrite/noweb):
(test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/accumulate/noweb):
(test-ob-header-arg-defaults/tree/complex/call):
(test-ob-header-arg-defaults/tree/complex/noweb):
* testing/lisp/test-ob.el (test-ob/elisp-in-header-arguments):
* testing/lisp/test-property-inheritance.el
(test-org-property-accumulation-overwrite-use): Update syntax.
(test-org-property-accumulation-append-use): Use new syntax.
(test-org-property-accumulation-top-val)
(test-org-property-accumulation-overwrite-val)
(test-org-property-accumulation-append-val): Remove tests.
This commit is contained in:
Nicolas Goaziou 2016-07-03 15:52:42 +02:00
parent ea94c14d92
commit f38f83b4f1
10 changed files with 87 additions and 118 deletions

View File

@ -15338,11 +15338,7 @@ per-subtree basis using property drawers (see @ref{Property syntax}).
When properties are used to set default header arguments, they are always
looked up with inheritance, regardless of the value of
@code{org-use-property-inheritance}. Properties are evaluated as seen by the
outermost call or source block.@footnote{The deprecated syntax for default
header argument properties, using the name of the header argument as a
property name directly, evaluates the property as seen by the corresponding
source block definition. This behavior has been kept for backwards
compatibility.}
outermost call or source block.
In the following example the value of
the @code{:cache} header argument will default to @code{yes} in all code

View File

@ -109,8 +109,34 @@ The modification time will be determined via =vc.el= if the second
argument is non-nil. See the manual for details.
*** Preparation and completion functions in publishing projects change signature
Preparation and completion functions are now called with an argument,
which is the project property list. It used to be dynamically scoped
which is the project property list. It used to be dynamically scoped
through the ~project-plist~ variable.
*** Old Babel header properties are no longer supported
Using header arguments as property names is no longer possible. As
such, the following
#+BEGIN_EXAMPLE
,* Headline
:PROPERTIES:
:exports: code
:var: a=1 b=2
:var+: c=3
:END:
#+END_EXAMPLE
should be written instead
#+BEGIN_EXAMPLE
,* Headline
:PROPERTIES:
:header-args: :exports code
:header-args: :var a=1 b=2
:header-args+: :var c=3
:END:
#+END_EXAMPLE
Please note that, however, old properties were defined at the source
block definition. Current ones are defined where the block is called.
** New features
*** New org-protocol key=value syntax
@ -302,7 +328,7 @@ an :indent parameter, much like the one in the clock table.
On the other hand, stars no longer appear in an ITEM field.
*** Columns view
**** ~org-columns~ accepts a prefix argument
When called with a prefix argument, ~org-columns~ apply to the whole
pWhen called with a prefix argument, ~org-columns~ apply to the whole
buffer unconditionally.
**** New variable : ~org-agenda-view-columns-initially~
The variable used to be a ~defvar~, it is now a ~defcustom~.

View File

@ -1412,21 +1412,6 @@ Return a list of association lists of source block params
specified in the properties of the current outline entry."
(save-match-data
(list
;; DEPRECATED header arguments specified as separate property at
;; point of definition.
(org-babel-parse-multiple-vars
(delq nil
(mapcar
(lambda (header)
(let* ((arg (symbol-name (car header)))
(val (org-entry-get (point) arg t)))
(and val
(cons (intern (concat ":" arg))
(org-babel-read val)))))
(org-babel-combine-header-arg-lists
org-babel-common-header-args-w-values
(let ((sym (intern (concat "org-babel-header-args:" lang))))
(and (boundp sym) (eval sym t)))))))
;; header arguments specified with the header-args property at
;; point of call.
(org-babel-parse-header-arguments

View File

@ -141,7 +141,7 @@
* executing an lob call line
:PROPERTIES:
:results: silent
:header-args: :results silent
:ID: fab7e291-fde6-45fc-bf6e-a485b8bca2f0
:END:
@ -202,7 +202,7 @@ src_sh{echo 3} Here is one at the beginning of a line.
* exported inline source block
:PROPERTIES:
:ID: cd54fc88-1b6b-45b6-8511-4d8fa7fc8076
:exports: code
:header-args: :exports code
:END:
Here is one in the middle src_sh{echo 1} of a line.
Here is one at the end of a line. src_sh{echo 2}
@ -230,7 +230,7 @@ Here is one that is also evaluated: src_sh[:exports both]{echo 4}
* using the =:noweb-ref= header argument
:PROPERTIES:
:ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8a0
:noweb-sep: ""
:header-args: :noweb-sep ""
:END:
#+begin_src sh :tangle yes :noweb yes :shebang "#!/bin/sh"
@ -259,7 +259,7 @@ Here is one that is also evaluated: src_sh[:exports both]{echo 4}
* resolving sub-trees as references
:PROPERTIES:
:ID: 2409e8ba-7b5f-4678-8888-e48aa02d8cb4
:results: silent
:header-args: :results silent
:END:
#+begin_src emacs-lisp :var text=d4faa7b3-072b-4dcf-813c-dd7141c633f3
@ -315,7 +315,7 @@ and another
* in order evaluation on export
:PROPERTIES:
:exports: results
:header-args: :exports results
:ID: 96cc7073-97ec-4556-87cf-1f9bffafd317
:END:

View File

@ -7,7 +7,7 @@ This is an example file for use by the Org-mode tests.
* top
** code block
:PROPERTIES:
:tangle: yes
:header-args: :tangle yes
:CUSTOM_ID: code-block-section
:END:
Here are a couple of code blocks.
@ -18,8 +18,8 @@ Here are a couple of code blocks.
#+end_src
* accumulating properties in drawers
:PROPERTIES:
:var+: bar=2
:var: foo=1
:header-args+: :var bar=2
:header-args: :var foo=1
:ID: 75282ba2-f77a-4309-a970-e87c149fe125
:END:

View File

@ -1,7 +1,5 @@
#+TITLE: Tests for default header arguments to Babel source blocks
#+OPTIONS: ^:nil
#+PROPERTY: var t1="go1" t3="go3_clobbered"
#+PROPERTY: var+ t2="go2" t3="go3"
#+PROPERTY: header-args :var t1="gh1" t2="gh2_clobbered"
#+PROPERTY: header-args+ :var t4="gh4" t2="gh2" :var end=9
#+PROPERTY: header-args:emacs-lisp :var t1="ge1" t4="ge4_clobbered"
@ -25,11 +23,10 @@
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | go1 | go2 | go3 | --- | --- | --- | --- | --- | --- |
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Result | ge1 | gh2 | go3 | ge4 | ge5 | --6 | --7 | --8 | --9 |
| Result | ge1 | gh2 | --3 | ge4 | ge5 | --6 | --7 | --8 | --9 |
#+CALL: showvar() :results silent
#+BEGIN_SRC emacs-lisp :var end=7
@ -40,7 +37,6 @@
** Overwrite
:PROPERTIES:
:ID: a9cdfeda-9f31-4bb5-b694-2cf452f07dfd
:var: t6="to6"
:header-args: :var t7="th7"
:header-args:emacs-lisp: :var t8="te8"
:header-args:emacs-lisp+: :results silent :noweb yes :var end=9
@ -48,18 +44,16 @@
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | go1 | go2 | go3 | --- | --- | --- | --- | --- | --- |
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | --- | --- | --- | --- | --- | to6 | --- | --- | --- |
| header-args | --- | --- | --- | --- | --- | --- | th7 | --- | --- |
| header-args:emacs-lisp | --- | --- | --- | --- | --- | --- | --- | te8 | --- |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Result #+CALL | ge1 | gh2 | go3 | ge4 | ge5 | to6 | th7 | te8 | --9 |
| Result noweb | --1 | --2 | --3 | --4 | --5 | to6 | th7 | te8 | --9 |
| Result #+CALL | ge1 | gh2 | --3 | ge4 | ge5 | --6 | th7 | te8 | --9 |
| Result noweb | --1 | --2 | --3 | --4 | --5 | --6 | th7 | te8 | --9 |
#+CALL: showvar() :results silent
#+BEGIN_SRC emacs-lisp
@ -69,26 +63,22 @@
** Accumulate
:PROPERTIES:
:ID: 1d97d258-fd50-4107-a095-e4625bffc57b
:var+: t1="to1"
:var+: t6="to6"
:header-args+: :var t2="th2" t3="th3"
:header-args:emacs-lisp+: :var t5="te5" end=8
:END:
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | go1 | go2 | go3 | --- | --- | --- | --- | --- | --- |
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var+ property | to1 | --- | --- | --- | --- | to6 | --- | --- | --- |
| header-args+ | --- | th2 | th3 | --- | --- | --- | --- | --- | --- |
| header-args:emacs-lisp+ | --- | --- | --- | --- | te5 | --- | --- | --- | --- |
|-------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Result #+CALL | ge1 | th2 | th3 | ge4 | te5 | to6 | --7 | --8 | --9 |
| Result noweb | ge1 | th2 | th3 | ge4 | te5 | to6 | --7 | --8 | --9 |
| Result #+CALL | ge1 | th2 | th3 | ge4 | te5 | --6 | --7 | --8 | --9 |
| Result noweb | ge1 | th2 | th3 | ge4 | te5 | --6 | --7 | --8 | --9 |
#+CALL: showvar(end=6) :results silent
#+BEGIN_SRC emacs-lisp
@ -98,8 +88,6 @@
** Complex
:PROPERTIES:
:ID: fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2
:var: t1="to1"
:var+: t6="to6"
:header-args+: :var t2="th2"
:header-args:emacs-lisp: :var t5="te5" end=7
:header-args:emacs-lisp+: :results silent :noweb yes :var end=9
@ -107,18 +95,16 @@
| Global | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | go1 | go2 | go3 | --- | --- | --- | --- | --- | --- |
| header-args | gh1 | gh2 | --- | gh4 | --- | --- | --- | --- | --- |
| header-args:emacs-lisp | ge1 | --- | --- | ge4 | ge5 | --- | --- | --- | --- |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Tree | t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| var property | to1 | --- | --- | --- | --- | to6 | --- | --- | --- |
| header-args+ | --- | th2 | --- | --- | --- | --- | --- | --- | --- |
| header-args:emacs-lisp | --- | --- | --- | --- | te5 | --- | --- | --- | --- |
|------------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----|
| Result #+CALL | gh1 | th2 | go3 | gh4 | te5 | to6 | --7 | --8 | --9 |
| Result noweb | gh1 | th2 | --3 | gh4 | te5 | to6 | --7 | --8 | --9 |
| Result #+CALL | gh1 | th2 | go3 | gh4 | te5 | --6 | --7 | --8 | --9 |
| Result noweb | gh1 | th2 | --3 | gh4 | te5 | --6 | --7 | --8 | --9 |
#+CALL: showvar(end=6) :results silent
#+BEGIN_SRC emacs-lisp

View File

@ -1,36 +1,25 @@
#+property: var foo=1
#+property: var+ bar=2
#+property: header-args :var foo=1
#+property: header-args+ :var bar=2
#+begin_src emacs-lisp
(+ foo bar)
#+end_src
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src
* overwriting a file-wide property
:PROPERTIES:
:var: foo=7
:header-args: :var foo=7
:END:
#+begin_src emacs-lisp
foo
#+end_src
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src
* appending to a file-wide property
:PROPERTIES:
:var+: baz=3
:header-args+: :var baz=3
:END:
#+begin_src emacs-lisp
(+ foo bar baz)
#+end_src
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src

View File

@ -24,53 +24,59 @@
(org-test-at-id "3fdadb69-5d15-411e-aad0-f7860cdd7816"
(org-babel-next-src-block 1)
(forward-line -1)
(should (equal "ge1/gh2/go3/ge4/ge5/--6/--7/--8/--9"
(should (equal "ge1/gh2/--3/ge4/ge5/--6/--7/--8/--9"
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(ert-deftest test-ob-header-arg-defaults/global/noweb ()
(org-test-at-id "3fdadb69-5d15-411e-aad0-f7860cdd7816"
(org-babel-next-src-block 1)
(should (equal "ge1/gh2/go3/ge4/ge5/--6/--7"
(should (equal "ge1/gh2/--3/ge4/ge5/--6/--7"
(org-babel-execute-src-block)))))
(ert-deftest test-ob-header-arg-defaults/tree/overwrite/call ()
(org-test-at-id "a9cdfeda-9f31-4bb5-b694-2cf452f07dfd"
(org-babel-next-src-block 1)
(forward-line -1)
(should (equal "ge1/gh2/go3/ge4/ge5/to6/th7/te8/--9"
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(should
(equal "ge1/gh2/--3/ge4/ge5/--6/th7/te8/--9"
(org-test-at-id "a9cdfeda-9f31-4bb5-b694-2cf452f07dfd"
(org-babel-next-src-block 1)
(forward-line -1)
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(ert-deftest test-ob-header-arg-defaults/tree/overwrite/noweb ()
(org-test-at-id "a9cdfeda-9f31-4bb5-b694-2cf452f07dfd"
(org-babel-next-src-block 1)
(should (equal "--1/--2/--3/--4/--5/to6/th7/te8/--9"
(org-babel-execute-src-block)))))
(should
(equal "--1/--2/--3/--4/--5/--6/th7/te8/--9"
(org-test-at-id "a9cdfeda-9f31-4bb5-b694-2cf452f07dfd"
(org-babel-next-src-block 1)
(org-babel-execute-src-block)))))
(ert-deftest test-ob-header-arg-defaults/tree/accumulate/call ()
(org-test-at-id "1d97d258-fd50-4107-a095-e4625bffc57b"
(org-babel-next-src-block 1)
(forward-line -1)
(should (equal "ge1/th2/th3/ge4/te5/to6"
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(should
(equal "ge1/th2/th3/ge4/te5/--6"
(org-test-at-id "1d97d258-fd50-4107-a095-e4625bffc57b"
(org-babel-next-src-block 1)
(forward-line -1)
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(ert-deftest test-ob-header-arg-defaults/tree/accumulate/noweb ()
(org-test-at-id "1d97d258-fd50-4107-a095-e4625bffc57b"
(org-babel-next-src-block 1)
(should (equal "ge1/th2/th3/ge4/te5/to6/--7/--8"
(org-babel-execute-src-block)))))
(should
(equal "ge1/th2/th3/ge4/te5/--6/--7/--8"
(org-test-at-id "1d97d258-fd50-4107-a095-e4625bffc57b"
(org-babel-next-src-block 1)
(org-babel-execute-src-block)))))
(ert-deftest test-ob-header-arg-defaults/tree/complex/call ()
(org-test-at-id "fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2"
(org-babel-next-src-block 1)
(forward-line -1)
(should (equal "gh1/th2/go3/gh4/te5/to6"
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(should
(equal "gh1/th2/--3/gh4/te5/--6"
(org-test-at-id "fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2"
(org-babel-next-src-block 1)
(forward-line -1)
(org-babel-execute-src-block nil (org-babel-lob-get-info))))))
(ert-deftest test-ob-header-arg-defaults/tree/complex/noweb ()
(org-test-at-id "fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2"
(org-babel-next-src-block 1)
(should (equal "gh1/th2/--3/gh4/te5/to6/--7/--8/--9"
(org-babel-execute-src-block)))))
(should
(equal "gh1/th2/--3/gh4/te5/--6/--7/--8/--9"
(org-test-at-id "fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2"
(org-babel-next-src-block 1)
(org-babel-execute-src-block)))))
(provide 'test-ob-header-arg-defaults)

View File

@ -136,15 +136,14 @@ should still return the link."
* elisp forms in header arguments
:PROPERTIES:
:var: prop = (* 7 6)
:header-args: :var prop = (* 7 6)
:END:
#+begin_src emacs-lisp
prop
#+end_src"
(goto-char (point-min))
(org-babel-next-src-block)
(let ((info (org-babel-get-src-block-info)))
(should (= 42 (org-babel-execute-src-block))))))
(should (= 42 (org-babel-execute-src-block)))))
(ert-deftest test-ob/simple-named-code-block ()
"Test that simple named code blocks can be evaluated."

View File

@ -33,36 +33,18 @@
(org-babel-next-src-block 1)
(should (equal 3 (org-babel-execute-src-block)))))
(ert-deftest test-org-property-accumulation-top-val ()
(test-org-in-property-buffer
(goto-char (point-min))
(org-babel-next-src-block 2)
(should (string= "foo=1 bar=2" (org-babel-execute-src-block)))))
(ert-deftest test-org-property-accumulation-overwrite-use ()
(test-org-in-property-buffer
(goto-char (point-min))
(org-babel-next-src-block 3)
(org-babel-next-src-block 2)
(should (= 7 (org-babel-execute-src-block)))))
(ert-deftest test-org-property-accumulation-overwrite-val ()
(test-org-in-property-buffer
(goto-char (point-min))
(org-babel-next-src-block 4)
(should (string= "foo=7" (org-babel-execute-src-block)))))
(ert-deftest test-org-property-accumulation-append-use ()
(test-org-in-property-buffer
(goto-char (point-min))
(org-babel-next-src-block 5)
(org-babel-next-src-block 3)
(should (= 6 (org-babel-execute-src-block)))))
(ert-deftest test-org-property-accumulation-append-val ()
(test-org-in-property-buffer
(goto-char (point-min))
(org-babel-next-src-block 6)
(should (string= "foo=1 bar=2 baz=3" (org-babel-execute-src-block)))))
(provide 'test-ob-R)
;;; test-ob-R.el ends here