* lisp/org-capture.el (org-capture-fill-template): Don't throw
a user error when immediately finishing a template from which
an initial annotation is missing, warn instead.
This fixes 78ec8da52a. Thanks to Eric Fraga for reporting this.
* lisp/org-capture.el (org-capture-finalize): When capturing
an entry, fix missing final newline when the user has deleted
it.
This continues the fix done in d8c51531c.
* lisp/org-capture.el (org-capture-fill-template): Throw a
user error when :immediate-finish is `t' and when the %a
template could not be expanded.
Thanks to Leo Gaspard for this idea.
* lisp/org-capture.el (org-capture-place-entry): Place point
correctly before narrowing the buffer.
* testing/lisp/test-org-capture.el (test-org-capture/entry):
Fix test.
Thanks to Bernt Hansen for reporting this.
* doc/org-manual.org: Add `:tree-type month' option for capture
templates.
* lisp/org-capture.el (org-capture-set-target-location): Add
`:tree-type month' option to capture templates to group entries by
month.
* lisp/org-datetree.el (org-datetree-find-month-create): Add
`org-datetree-find-month-create' function to add datetree entries
grouped by month.
* testing/lisp/test-org-datetree.el
(test-org-datetree/find-month-create): Add test for new function.
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.
* lisp/org-agenda.el (org-agenda-get-timestamps, org-agenda-get-progress)
(org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-clock.el (org-clock-get-sum-start):
* lisp/org.el (org-current-time, org-store-link)
(org-read-date, org-read-date-display)
(org-display-custom-time, org-timestamp-to-time)
Simplify use of encode-time.
* lisp/org-clock.el (org-clock-in, org-clock-update-time-maybe):
* lisp/org-colview.el (org-columns--age-to-minutes):
* lisp/org-macs.el (org-2ft):
* lisp/org.el (org-get-scheduled-time, org-get-deadline-time)
(org-add-planning-info, org-time-string-to-absolute)
(org-closest-date):
Use org-time-string-to-time instead of doing it by hand with
encode-time.
* lisp/org.el (org-read-date): Avoid extra trip through encode-time.
Simplify use of encode-time
988e37fa0f922b852715671d59a0e3f682373411
Paul Eggert
Sun Feb 10 23:54:35 2019 -0800
Note(km): org-current-time has been modified to use org-time-subtract
and org-time-less-p for backward compatibility. Some changes from
988e37fa0 have been dropped to keep encode-time's call compatible with
older Emacsen.
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
Omit unnecessary ‘?’ after nullable pattern.
* lisp/org-capture.el (org-capture-fill-template):
Match upper-case as well as lower-case letters.
Fix 2019-08-04 regex lint
a5b796a8798a809044d847568e6472cc5eca077e
Paul Eggert
Sun Aug 4 11:39:54 2019 -0700
2019-07-27 Carsten Dominik <carsten.dominik@gmail.com>
* lisp/org-capture.el (org-capture-fill-template): Keep [[]]
around the %l link annotation.
When capture is called from a buffer and the template includes a %l
annotation, then this link needs to be enclosed in [[ ... ]]. The
default link is a search link that searches for the line at point -
and when the link contains whitespace, it needs to be part of the link.
* lisp/org-capture.el (org-capture-place-item): When there is no list
to augment, insert new list after planning info and properties
drawers.
* testing/lisp/test-org-capture.el (test-org-capture/item): Add tests.
Reported-by: Allen Li <darkfeline@felesatra.moe>
<http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00060.html>
* lisp/org-capture.el (org-capture-fill-template): Prevent raising an
error when template is an empty entry.
* testing/lisp/test-org-capture.el (test-org-caputre/entry): Add test.
Reported-by: Roland Everaert <reveatwork@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00019.html>
* lisp/org-clock.el (org-clock-out):
* lisp/org.el (org-evaluate-time-range):
Avoid double-rounding of time-related values. Simplify.
* lisp/org-clock.el (org-resolve-clocks-if-idle):
Use time-since instead of open-coding most of it.
* lisp/org-agenda.el (org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-table.el (org-table-sum):
* lisp/org.el (org-babel-load-file, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now):
Simplify.
Note(km): Many of the changes from 476066e89 have been dropped for
compatibility with older Emacsen.
Avoid some double-rounding of Lisp timestamps
476066e89d6f0bb87220da690b8a476bf9655b80
Paul Eggert
Fri Feb 22 18:33:57 2019 -0800
* lisp/org-capture.el (org-capture-place-table-line): Remove
unnecessary call to `org-table-align', which could insert a spurious
newline character.
Reported-by: Thomas Holst <Thomas_Holst@gmx.de>
<http://lists.gnu.org/r/emacs-orgmode/2019-01/msg00233.html>
* lisp/org-capture.el (org-capture-finalize): Do not save the target
capture file if :no-save keyword is non-nil in the capture template.
* doc/org-manual.org (Template elements),
lisp/org-capture.el (org-capture-templates): Document :no-save.
Ref: https://lists.gnu.org/r/emacs-orgmode/2018-09/msg00325.html
* lisp/org-capture.el (org-capture-place-entry): Store position at the
beginning of the capture entry, not at its end.
* testing/lisp/test-org-capture.el (test-org-caputre/entry): Add test.
* lisp/org-capture.el (org-capture-place-plain-text): Fix plain
capture at the end of the buffer.
* testing/lisp/test-org-capture.el (test-org-capture/plain): New test.
* lisp/org-capture.el (org-capture-place-entry): Fix delimiters for
region to delete when aborting capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.