org-mode/testing/examples/property-inheritance.org

28 lines
385 B
Org Mode
Raw Normal View History

Org document property-drawers Add functionality to define property-blocks on document level, in addition to at headline level. * doc/org-manual.org: * etc/ORG-NEWS: Document new functionality. * lisp/org.el (org-keyword-regexp): Define constant instead of hardcoding. (org-file-properties): Renamed, see next line. (org-keyword-properties): Renamed from above. Due to the fact that properties can be defined for the whole document using property drawers this local variable needs a rename to make its name less ambigous. (org-refresh-properties, org-refresh-property, org-entry-properties) (org-refresh-category-properties, org-get-property-block) (org-entry-get-with-inheritance, org-entry-put) (org-insert-property-drawer, org-end-of-subtree): Made to work before first headline. (org-at-property-block-p): New function to validate if point is at the start of a property block. (org-property-global-value): Renamed, see next line. (org-property-global-or-keyword-value): Renamed from above to match its functionality better. (org-back-to-heading-or-point-min): New function to make a document work as a level 0 node in the outline. (org-at-keyword-p): Predicate function to answer to if we're currently at a keyword line or not. (org-up-heading-or-point-min): New function to make a document work as a level 0 node in the outline. * lisp/org-element.el (org-element--current-element): Can now detect property-blocks before first headline according to it's positional rules. * lisp/org-attach.el (org-attach): Make it possible to call the attachment dispatcher also before the first headline, since document property drawers make attachments possible for the whole document now. * lisp/org-capture.el: Modified only due to rename of function in org.el. * lisp/org-compat.el (org-file-properties) (org-property-global-value): Renamed functions declared obsolete. * testing/lisp/test-org.el (org/insert-property-drawer) (org/set-property, org/delete-property, org/delete-property-globally): Additions of tests to check if they work before first headline. (org/at-property-p, org/at-property-block-p, org/get-property-block) (org/entry-get, org/refresh-properties): New tests * testing/examples/property-inheritance.org: Switch from property-keywords to a property-drawer in the testfile. Functionality should be the same, but now using a document drawer instead of property-keywords. Reason for switching is that I'd like us to slowly depricate property-keywords. * testing/lisp/test-org-element.el: * contrib/lisp/ox-taskjuggler.el: A comment is modified only due to rename of function in org.el.
2019-05-26 20:13:09 +00:00
:PROPERTIES:
:header-args: :var foo=1
:header-args+: :var bar=2
:END:
#+begin_src emacs-lisp
(+ foo bar)
#+end_src
* overwriting a file-wide property
:PROPERTIES:
:header-args: :var foo=7
:END:
#+begin_src emacs-lisp
foo
#+end_src
* appending to a file-wide property
:PROPERTIES:
:header-args+: :var baz=3
:END:
#+begin_src emacs-lisp
(+ foo bar baz)
#+end_src