* lisp/org-capture.el (org-capture): if dired isn't loaded,
`dired-buffers' isn't defined, and %F will fail.
Thanks to Puneeth Chaganti for reporting this.
* lisp/org-capture.el (org-capture): if no file is associated to
current buffer, check dired buffer and try to retreive a possibly
directory associated.
* org-capture.el (org-capture-finalize): bugfix about
inserted blank line when killing the capture buffer and
`org-blank-before-new-entry' tells to not insert anything
before a heading.
Thanks to Leo for reporting this.
* 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.
* lisp/org-capture.el (org-capture): Remove read-only text properties
from capture text.
(org-capture-set-target-location): Throw an error if file+headline
target does not point into a file which is in Org mode.
Richard Riley writes:
> If I select a region in, in this case, an erc (emacs irc client)
> buffer in the read only section and then use my global keys to create
> a new item using the following "j" template while the text is still
> selected
>
> ("j" "Journal" entry
> (file+datetree "journal.org")
> "* %T %?\n %i\n %a")
>
> then I get the following backtrace :-
>
> Debugger entered--Lisp error: (error "Capture abort: (text-read-only)")
> signal(error ("Capture abort: (text-read-only)"))
> error("Capture abort: %s" (text-read-only))
> byte-code("\301\302!\203\n
* org-capture.el (org-capture-place-item): use `org-search-forward-unenclosed'
and `org-search-backward-unenclosed' and new variable `org-item-beginning-re'.
* org-list.el (org-item-beginning-re): regexp matching beginning of an item.
Jambunathan K <kjambunathan@gmail.com> writes:
> It would be convenient if I could do a
>
> M-x customize-group org-capture and/or
> M-x customize-variable org-capture-templates
>
> without having triggered a prior org-capture.
>
> For now, I trigger a capture, abort it and then proceed ahead with
> customizing these.
Here is a patch that adds an "autoload cookie" for
org-capture-templates. After recompiling, org-install.el should contain
an autoload declaration for org-capture-templates.
Let's see if the patch tracker likes me :)
Magnus
* lisp/org-capture.el (org-capture-place-template): Handle the checkitem
case.
(org-capture-place-item): Provide boundaries for the search to make
sure we do not get a match in a different tree.
* lisp/org-capture.el (org-capture-finalize): Fix clock in of interrupted
task during capture finalize
Calling org-capture-get inside the org-with-point-at macro does not
work when the current clocking task and the capture target buffer are
the same. In this case the captured task would continue clocking
instead of switching back to the previously clocking task.
* lisp/org-capture.el (org-capture-target-buffer): Throw an error
if we have no target file.
(org-capture-select-template): Use a default template if the user has
not specified any.
* lisp/org-macs.el (org-string-nw-p): New function.
* lisp/org-capture.el (org-capture-import-remember-templates): Interpret
an empty string as request to use `org-default-notes-file'.
(org-capture-target-buffer): If the FILE is not a (non-empty) string,
use `org-default-notes-file'.
* lisp/org-capture.el (org-capture-fill-template): Do inserting file
contents and expanding sexp escapes first, so that further escape
processing can happen in the inserted text.
This was a request by Sebastian Rose.
This patch makes some straightforward corrections to a number of
docstrings. Each change is normally to:
- correct a typo, or
- fix up hyperlinks to function or variable names, or
- ensure slightly better conformance with the documentation guidelines
and tips given in the Elisp manual
No attempt is made to provide missing docstrings or document arguments.
Cheers,
Phil
* lisp/org-capture.el (org-capture-set-plist): Make sure txt is a string
before calling `string-match'.
(org-capture-templates): Fix customization type.
Modified from a patch proposal by Johan Friis.
TINYCHANGE
* org-capture.el (org-capture): Check if
`org-capture-link-is-already-stored' is bound before evaluating.
If `org-protocol-capture' is the first function that calls
`org-capture', this variable is locally bound while it is globally
unbound. I.e. org-capture.el was not loaded before, the defvar not
evaluated. If `org-protocol-capture' exits, Emacs restores the global
value, which is void.
* lisp/org-capture.el (org-capture-templates): Allow the template
to come from a file or function call.
(org-capture-place-entry): Get the template from file or function.
* lisp/org-capture.el (org-capture-set-target-location): Store
exact positions for file+regexp and file+function targets.
(org-capture-place-entry, org-capture-place-item)
(org-capture-place-table-line, org-capture-place-plain-text): Respect
exact positions.
(org-capture-finalize): Make sure we are at the beginning of a line
when fixing the empty lines after the entry.
* lisp/org-capture.el (org-capture-fill-template): Respect
time-of-day preference in template prompt.
In an interactive time prompt in a capture template, the users
preference of getting a stamp with time was not respected.
Reported by Markus Heller
* lisp/org-agenda.el (org-agenda-action): Make `c' key call org-capture.
* lisp/org-capture.el: New file.
* lisp/org-compat.el (org-get-x-clipboard): Function moved here from
remember.el.
* lisp/org-mks.el: New file
* lisp/org.el (org-set-regexps-and-options): Allow statistic cookies as
part of complex headlines.
(org-find-olp): New argument THIS-BUFFER. When set, assume that the
OLP does not contain a file name.