On Sat, Oct 22, 2011 at 9:07 PM, Christian Moe
<mail@christianmoe.com> wrote:
Hi,
Eric Schulte wrote:
I can think of three options for how to handle this situation.
1. If it turns out to be possible/desirable my preferred solution
here would be to add general property support for appending values
to properties when properties are over specified
(...)
2. Adding a "#+PROPERTY:" line authoring helper similar to the
table formula helper making it more natural to edit such long
property lines.
3. It may be possible to add syntax for extending #+PROPERTY:
specifications across multiple lines, something like
#+PROPERTY: var MAINVERSION=0,
> #+PROPERTY+: SVNVERSION=(vc-working-
revision (buffer-file-name)),
(...)
These are all interesting ideas, as was Darlan's alternative suggestion to Eric's suggestion (1), namely to use a special inherit argument.
I'd like to toss out a different idea, which I think is brilliant, but which may go down in flames once we've had a time to think it through. (And sorry if it's been proposed before; I came to Org just as Org-Babel was being stabilized.)
In short, let Babel assign to any declared variables of a src block the values of any properties at point with the same name. In other words:
- The :var header argument / :var: property could declare variables without assigning values, that is, you could have
`:var foo=1, bar, baz=3' to tell Babel that `bar' is a variable too.
- When a variable is declared, but no value assigned, Babel would look for a property (e.g. `:bar: 2') at point with the same name as the variable.
- If property inheritance is turned on, this means a variable can be specified at any level of the outline.
- If no further changes were made (such as the property accumulation Eric suggested), it would still be possible to /declare/ variables only at /one/ level of the outline besides in the code block and calls, since declarations all belong to the same `:var:' property. However, this approach would mean that declarations could be kept short and there would be a great deal of modularity in what values would be assigned.
This all sounds very interesting, but I have problems understanding the advantages - possibly because I only had one coffee this morning. In addition see further down:
SNIP
On 10/22/11 5:52 PM, Eric Schulte wrote:
#+BABEL: :var MAINVERSION=0
#+BABEL: :var SVNVERSION=(vc-working-revision (buffer-file-name))
#+BABEL: :var SVNSTATE=( symbol-name (vc-state (or (buffer-file-name) org-current-export-file)))
#+BABEL: :var SVNSTATENUM=(if (eq (vc-state (or (buffer-file-name) org-current-export-file)) 'up-to-date) 0 13)
#+BABEL: :var DISP_PACKAGE="seedDisp_0.4-13.tar.gz"
Have a buffer-level property for all the long lines (sorry if my email client wraps these lines):
#+PROPERTY: SVNVERSION (vc-working-revision (buffer-file-name))
#+PROPERTY: SVNSTATE ( symbol-name (vc-state (or (buffer-file-name) org-current-export-file)))
#+PROPERTY: SVNSTATENUM (if (eq (vc-state (or (buffer-file-name) org-current-export-file)) 'up-to-date) 0 13)
#+PROPERTY: DISP_PACKAGE "seedDisp_0.4-13.tar.gz"
I think this syntax opens the door for dangerous typos - If you type e.g:
#+PROPERTY: vat x=10
what would this be? it should have been
#+PROPERTY: var x=10
but now? One could allow this syntax in the case that the variable has been defined before, by using the var syntax:
so
#+PROPERTY: var MAINVERSION=0, SVNVERSION, SVNSTATE, SVNSTATENUM, DISP_PACKAGE
#+PROPERTY: SVNVERSION (vc-working-revision (buffer-file-name))
#+PROPERTY: SVNSTATE ( symbol-name (vc-state (or (buffer-file-name) org-current-export-file)))
#+PROPERTY: SVNSTATENUM (if (eq (vc-state (or (buffer-file-name) org-current-export-file)) 'up-to-date) 0 13)
#+PROPERTY: DISP_PACKAGE "seedDisp_0.4-13.tar.gz"
should be OK, as SVNVERSION is already defined, but
#+PROPERTY: SVNVERSION (vc-working-revision (buffer-file-name))
#+PROPERTY: SVNSTATE ( symbol-name (vc-state (or (buffer-file-name) org-current-export-file)))
#+PROPERTY: SVNSTATENUM (if (eq (vc-state (or (buffer-file-name) org-current-export-file)) 'up-to-date) 0 13)
#+PROPERTY: DISP_PACKAGE "seedDisp_0.4-13.tar.gz"
#+PROPERTY: var MAINVERSION=0, SVNVERSION, SVNSTATE, SVNSTATENUM, DISP_PACKAGE
not, as the variables are only defined later.
But this would not make
#+PROPERTY+:
redundant, but rather enhance it.
Cheers,
Rainer
Cheers,
Rainer
SNIP
Yours,
Christian