* lisp/org-capture.el (org-capture-current-plist): Improve docstring.
(org-capture-put): Add docstring.
(org-capture-get): Add docstring.
(org-capture-member): Add LOCAL argument. Add docstring.
(org-capture-set-target-location): Store the time received from a date
prompt into the :prompt-time property.
When using the file+datetree+prompt target for capture, the time set
by the prompt is now stored in the :prompt-time property.
* org-capture.el (org-capture-clock-keep): New local variable.
(org-capture, org-capture-finalize): Use it and fix a bug when
:clock-keep is set to `t'.
* lisp/org.el (org-end-of-meta-data-and-drawers): New function.
* lisp/org-capture.el (org-capture-place-plain-text): Implement adding
plain text templates to Org nodes.
This is something which came out of a discussion with Philip Rooke, in
the thread
Philip tried to use a capture template with template type plain, but
using a date tree as a target. Plain templates where placed at the
end of the file, not at the end of the entry. I complained first that
mixing headlined entries and plain snippets into the same capture
target is not possible, but I realized that there is a way to make
this work OK. The headlined entries become children, and the plain
text snippets become part of the text before the first child.
(org-capture-templates): Rename :no-clock-out to :clock-keep.
(org-capture): Use :clock-keep instead of :no-clock-out.
Thanks to Bernt Hansen for the suggestion.
* org-capture.el (org-capture-templates): New option
:no-clock-out.
(org-capture): Use the new option.
* org.texi (Template elements): document the new template
option :no-clock-out.
* org-capture.el (org-capture-put-target-region-and-position):
New function to store information about the target buffer.
(org-capture-set-target-location): Use it.
(org-capture-finalize): restore the target buffer in its
possibly narrowed state. Also restore the cursor position.
* org-capture.el (org-capture-finalize): New argument
clock-out, to tell whether finalizing the capture process
should clock out the running clock.
(org-capture): Use the new argument.
* lisp/org-capture.el (org-capture-expand-file): New function.
(org-capture-target-buffer):
(org-capture-set-target-location): Use `org-capture-expand-file'.
* doc/org.texi (Template elements): Document that files can be given
as function, form, or variable.
* lisp/org-list.el (org-alphabetical-lists): new variable
(org-item-re, org-list-full-item, org-cycle-list-bullet,
org-list-struct-fix-bul, org-list-inc-bullet-maybe): reflect
introduction of the new variable.
(org-item-beginning-re): changed into a function, so any modification
of `org-alphabetical-lists' will not require reloading Org.
(org-at-item-p, org-toggle-checkbox, org-update-checkbox-count,
org-list-parse-list, org-list-send-list): reflect changes to
`org-item-beginning-re'.
(org-list-use-alpha-bul-p): new function.
* lisp/org.el (org-check-for-hidden): reflect changes to
`org-item-beginning-re'.
* lisp/org-capture.el (org-capture-place-item): reflect changes to
`org-item-beginning-re'.
* lisp/org-docbook.el (org-export-docbook-list-line): handle new type
of items.
* lisp/org-exp.el (org-export-mark-list-end,
org-export-mark-list-properties): reflect changes to
`org-item-beginning-re'.
* lisp/org-html.el (org-html-export-list-line): handle new type of
items.
* lisp/org-latex.el (org-export-latex-lists): handle new type of items
and reflect changes to `org-item-beginning-re'.
* lisp/org-ascii.el (org-export-ascii-preprocess): handle new counters.
Modified from a patch by Nathaniel Flath.
* lisp/org-list.el (org-list-search-generic): renamed form
org-search-unenclosed-generic to reflect now behavior. Now, match
can only be in a valid context for lists, as determined by
`org-list-context'.
(org-list-search-backward): renamed from
org-search-backward-unenclosed.
(org-list-search-forward): renamed from org-search-forward-unenclosed.
(org-toggle-checkbox,org-update-checkbox-count): use new functions.
(org-sort-list): using default regexp search functions as context is
not required in this case.
* lisp/org-ascii.el (org-export-ascii-preprocess): use new function
* lisp/org-capture.el (org-capture-place-item): use new function
* org-capture.el (org-capture-templates): document currentfile
for capture template.
(org-capture-templates): Allow to use currentfile for capture
templates.
(org-capture-set-target-location): Handle currentfile as a way
to setting the capture buffer.
* org.texi (Template elements): document currentfile for
capture templates.
* lisp/org-capture.el (org-capture-templates): Add %f and %F escapes
(org-capture): Add more information to capture property list
(org-capture-fill-template): Handle %f and %F escapes
* org-capture.el (org-capture-fill-template): Use `org-set-property'
directly.
* org.el (org-set-property): Split property and values reading.
(org-read-property-name, org-read-property-value)
(org-set-property-function): New functions.
(org-property-set-functions-alist): New variable.
The goal of this patch is to introduce a special variable
`org-property-set-functions-alist'. This variable allows to read
properties values in a more intelligent way from `org-set-property' or
from `org-capture'.
For that, it simplifies the `org-set-property' code and remove
duplication between `org-capture' and `org-set-property'.
Signed-off-by: Julien Danjou <julien@danjou.info>
* doc/org.texi (Template elements): Document the new entry type.
* lisp/org-capture.el (org-capture-templates): Add new option to customize
type and docstring.
(org-capture-set-target-location): Interpret the file+datetree+prompt
entry.
* lisp/org-capture.el (org-capture-templates): New capture
property `:kill-buffer'. (org-capture-finalize): Kill target buffer
if that is desired.
(org-capture-target-buffer): Remember if we have to make the buffer.
Proposal by Samuel Wales.
* lisp/org-capture.el (org-capture-empty-lines-before):
(org-capture-empty-lines-after): Make sure the n=0 does not insert any
newlines.
Marcel van der Boom writes:
> I'm in the process of migrating from org-remember to org-capture.
> Pretty easy going so far, but it seems org-capture adds newlines, which
> I think it should not do.
>
> My (test) capture-template is:
>
> (("t" "Todo" entry
> (file "~/.outlet/GTD.org")
> "* TODO %?" :prepend t :empty-lines 0)
>
> with the intention of inserting the captured task on the
> first line of the file ~/.outlet/GTD.org. What happens when I capture
> an task is this:
>
> <beginning of file>
>
> * TODO Captured task
>
> <original first line of file here>
> ....
>
> Both before and after the task is a newline. Also, when capturing and
> cancelling the capture with C-c C-k the newlines remain whereas the
> task is removed.
* lisp/org-capture.el (org-capture-place-entry): If the first
line is already a headline, just stay there.
Patch by THomas Fuchs.
TINYCHANGE
> I'm trying to capture and file an entry as an top-level entry as first entry
> in an org file without config at the beginning (no "#+").
> This leads to filing the entry as _second_ headline in the org file.
> The template is:
> ("z" "test" entry (file "~/Data/z.org") "* %^{Note} %t :NOTE:\n %?"
> :prepend t)
>
> I think this is due to jumping over lines starting with "#+" at the
> beginning of the org file
> (line 715 in org-capture.el (org-capture-place-entry)).
> My file has no config header and starts with the first headline. Calling
> outline-next-heading
> in this situation leads to jumping to the second headline in the file.
* org-capture.el (org-capture-place-template): Widen to remove
possible restrictions in target buffer.
Jules Bean wrote:
>If I run org-capture with the template:
>("t" "Todo" entry (file+headline
>"/Users/jules/work/TODO.org" "Tasks") "* TODO %?
> (Captured at %u)
> %i
> %a
>")
>whilst I have narrowed (using, e.g., org-narrow-to-subtree) the buffer
>that contains TODO.org, a new "* Tasks" headline is inserted at the
>end of my narrowing and the new entry is added there, which messes up
>the hierarchy of the file.