* org-capture.el (org-capture-fill-template): The capture template
buffer will be displayed in another window, keeping original window
visible if appropriate.
* lisp/org-capture.el (org-capture-expand-file): Empyt string defaults
to `org-default-notes-file'.
* lisp/org.el (org-default-notes-file): Do not fallback on
`remember-data-file' since "org-capture.el" is not based off
"remember.el" anymore.
Reported-by: Florian Lindner <mailinglists@xgm.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97448>
* lisp/org-capture.el (org-capture-fill-template): Expand %(sexp) after
%:keywords, per documentation about capture templates expansion.
When a template is expanded first the simple %-escapes, %:keywords and
after that the %(sexp).
TINYCHANGE
lisp/org-capture.el (org-capture-place-item): When starting a new list
use org-indent-line to establish the correct indentation rather than
just using 0.
Creating an entry in org-capture-templates of type item adds entries
into a list, however, currently, if the list is empty then the first
list item will always be indented to depth 0 (so hard on the left),
which looks like this:
* Top Level
** Second Level
- item #1
- item #2
- item #3
This is fine if org-adapt-indentation is nil, however, with the
default value of t lists should be indented more like this:
* Top Level
** Second Level
- item #1
- item #2
- item #3
The patch below changes org-capture-place-item so that, when starting
a new list, the items are indented as above.
Care is taken to preserve two features of the existing behaviour,
first, when adding to an existing list, new items are indented to
match the items already in the list. And secondly, when there is some
introductory text before the list new items are inserted after the
text, like this:
* Top Level
** Second Level
This is some introductory text:
- item #1
- item #2
- item #3
TINYCHANGE
* org-capture.el (org-capture-steal-local-variables): Don't
steal `mark-active', which should be nil in the target buffer.
Thanks to Alex Kosorukoff for raising this issue.
* org-capture.el (org-capture-fill-template): Deactivate
region while trying to align tags on the current headline.
Thanks to Alex Kosorukoff for reporting this.
* lisp/org-capture.el (org-capture-place-table-line): If the value of
`:table-line-pos' is a function name, used its return value to set the
position inside the table. The return value must be a string like
"II-3". Else `:table-line-pos' is 'eval'ed.
TINYCHANGE
* org-capture.el (org-capture-finalize): Ensure to widen the
buffer when the target buffer is not initially narrowed.
Thanks to Adam Spiers and Thomas Proschinger for reporting this bug.
* org-capture.el (org-capture-finalize): Ensure to widen the
buffer when the target buffer is not initially narrowed.
Thanks to Adam Spiers and Thomas Proschinger for reporting this bug.
* lisp/org-capture.el (org-capture-goto-last-stored): Use
`org-bookmark-names-plist'.
* lisp/org.el (org-refile-goto-last-stored): Use
`org-bookmark-names-plist'.
* lisp/org-capture.el (org-capture-place-entry): Set :exact-position
before doing other stuff, to allow function with other target settings
TINYCHANGE
Assuming file "test.org" has a single headline "* Level 1" (ended with
newline character), when trying to use function type capture target in
an org-capture template, as shown in the example:
(setq org-capture-templates
`(("t"
"Test function type target"
entry
(function
(lambda ()
(set-buffer (org-capture-target-buffer "test.org"))
(goto-char (point-max))))
"* Level 2")))
When this template gets filled, file "test.org" becomes:
* Level 1
* Level 2
Instead of:
* Level 1
** Level 2
This is because when using function type target, `:exact-position' is
used to store buffer position returned by user's function (the lambda
function here), and function `org-capture-place-entry' will never
insert template as a child of current entry when `:exact-position' is
used.
The problem is addressed by not special casing for `:exact-position'
in function `org-capture-place-entry'.
York
* org-capture.el (org-capture): Store :return-to-wconf
earlier.
(org-capture-place-template): Don't store :return-to-wconf
when called from a capture template using `function', rely on
the early :return-to-wconf value store from `org-capture'.
Thanks to Brett Viren for raising this issue.
* org.el (org-directory, org-default-notes-file)
(org-reverse-note-order): Don't use the `org-remember'
customization group.
(org-require-autoloaded-modules): Don't require
`org-remember'.
* org-capture.el: Update commentary section to reflect the
fact that org-remember.el is not used anymore.
* lisp/org-capture.el (org-capture-expand-embedded-elisp): Throw error if
result is not a string and not nil. If the result is nil, treat it as
if it was the empty string.
* lisp/org.el (org-bookmark-names-plist): New user option.
(org-set-regexps-and-options-for-tags): Use `org-bookmark-names-plist'.
(org-refile): Use `org-bookmark-names-plist'.
* lisp/org-capture.el (org-capture-bookmark-last-stored-position): Use
`org-bookmark-names-plist'.
Patch modified from a proposal by Oleh.
* org-capture.el (org-capture-set-target-location): Don't
throw an error when `org-time-was-given' is not bound.
Thanks to Eric S Fraga for reporting this.
* org-capture.el (org-mks): Fix bug: let-bind
`case-fold-search' to nil while matching the first letter of a
multi-letters template.
Thanks to Robert Goldman for reporting this bug and providing the fix.
* org-capture.el (org-capture-templates): Document new option
:jump-to-captured in the docstring. Offer the complete list
of options when customizing.
(org-capture-finalize): Handle :jump-to-captured.
This emulates the behavior triggered by %& in remember templates.
Thanks to Adam Spiers for reporting this.
* lisp/org-macs.el (org-if-unprotected, org-if-unprotected-1,
org-if-unprotected-at): Removed macros.
(org-re-search-forward-unprotected): Removed function.
* lisp/org.el (org-format-latex): Remove reference to `org-protected'.
* lisp/org-list.el (org-list-struct): Remove reference to
`org-example' and `org-protected'.
* lisp/org-footnote.el (org-footnote-at-reference-p): Remove reference
to `org-protected'.
* lisp/org-capture.el (org-capture-fill-template): Remove reference to
`org-protected'.
* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
Remove reference to `org-protected' value.
These text properties were used by the old export framework. They are
not needed anymore.
* org.el (org-contextualize-validate-key): Check against two
new context predicates [not-]in-buffer.
* org-capture.el (org-capture-templates-contexts):
* org-agenda.el (org-agenda-custom-commands-contexts):
Document the new [not-]in-buffer context predicates.
Thanks to Paul Sexton for triggering this and for proposing a patch.
* org.el (org-get-cursor-date): New optional argument
WITH-TIME to add the time of the day.
* org-capture.el (org-capture): When capturing from the agenda
and with a non-nil value for `org-capture-use-agenda-date', a
`C-1' prefix will set the capture time to the HH:MM of the
current line or the current HH:MM.
* org-agenda.el (org-agenda-capture): New optional argument
WITH-TIME: when set to 1, the capture time will be set to the
HH:MM time of the current line, or the current HH:MM time.
From an agenda buffer, C-1 k (i.e. org-agenda-capture) and
C-1 M-x org-capture RET will use the time of the day of the
current line, or the current time of the day. The date is
not changed by using this prefix.
Thanks to Rene for triggering this change.
* org.el (org-refile): Run within `with-demoted-errors' so
that a corrupted bookmark file does not stop the refile
process.
* org-capture.el (org-capture-bookmark-last-stored-position):
Ditto for the capture process.
Note: we do not prevent such errors in org-remember.el as this
libary will be obsoleted for the next major release of Org.
* org-capture.el (org-at-encrypted-entry-p)
(org-encrypt-entry, org-decrypt-entry): Declare.
(org-capture-set-target-location): Check whether `org-crypt'
has been loaded.
Thanks to Mike McLean for reporting this.
* org-capture.el (org-capture-finalize): Maybe re-encrypt
the target headline if it was decrypted.
(org-capture-set-target-location): Maybe decrypt the target
headline.
* org-crypt.el (org-at-encrypted-entry-p): New function.
Thanks to Guilherme Gondim for suggesting this.
* org-capture.el (org-capture-set-target-location): Set a
correct time value when storing a note in a datetree and
prompting the user for a date.
Thanks to Gregor Zattler for reporting this.
* org-capture.el (org-capture-entry): New variable.
(org-capture-string, org-capture): Use it to possibly skip the
interactive prompt for a capture template.
* org-capture.el (org-capture-use-agenda-date): New option.
(org-capture): Use it.
* org-agenda.el (org-agenda-capture): New command.
(org-agenda-mode-map): Bind it to `k'.
(org-agenda-menu): Add it to the menu.
* org.texi (Agenda commands): Document the new command and the
new option.
Thanks to Eric Abrahamsen who suggested this change, along with
other merging about bulk actions.
* org-capture.el (org-capture-fill-template): Protect the text
used for replacement from being further replaced.
Thanks to Moritz Ulrich for reporting this bug.
* org.el (org-contextualize-keys): Rename from
`org-contextualize-agenda-or-capture'. Fix normalization to
handle empty key replacement string.
(org-contextualize-validate-key): Rename from
`org-contexts-validate'. Allow checking against a custom
function.
* org-agenda.el (org-agenda-custom-commands-contexts): Update.
(org-agenda): Use `org-contextualize-keys'.
* org-capture.el (org-capture-templates-contexts): Ditto.
* org.texi (Templates in contexts, Setting Options): Update to
reflect changes in how contexts options are processed.
* org.el (org-contextualize-agenda-or-capture): Handle key
replacement depending on the contexts.
* org-capture.el (org-capture-templates-contexts): Allow to
use the context as a way to replace one capture template by
another one.
* org-agenda.el (org-agenda-custom-commands-contexts): Allow
to use the context as a way to replace one agenda custom
command by another one.
* org.texi (Templates in contexts): Document the new structure
of the variables `org-agenda-custom-commands-contexts' and
`org-capture-templates-contexts'.
In the setup below, X is not a real capture template, it is just
an alias to templates A and B in .txt and .el files. A and B are
deactivated by default in all files.
(setq org-capture-templates
'(("X" "Nothing but an alias")
("A" "AAAA" entry (file+headline [...]))
("B" "BBBB" entry (file+headline [...]))))
(setq org-capture-templates-contexts
'(("A" "A" ((not-in-file . ".*")))
("B" "B" ((not-in-file . ".*")))
("X" "A" ((in-file . "\\.txt")))
("X" "B" ((in-file . "\\.el")))))
Thanks to Carsten for suggesting this "key-replacement" idea!
* org.el (org-contextualize-agenda-or-capture)
(org-rule-validate): New functions, implement context
filtering for agenda commands and capture templates.
* org-agenda.el (org-agenda-custom-commands-contexts): New
option.
(org-agenda): Use it.
* org-capture.el (org-capture-templates-contexts): New option.
(org-capture-select-template): Use it.
* org.texi (Templates in contexts): Document the new option
`org-capture-templates-contexts'.
(Storing searches): Document the new option
`org-agenda-custom-commands-contexts'.
This idea comes from Sylvain Rousseau, who implemented a similar
feature with org-context.el: https://github.com/thisirs/org-context
This implementation is a bit simpler and more general. Simpler
because it relies on existing templates, no need to define other
contextual ones. More general because contexts can be defined
wrt files and modes.
Thanks *very much* to Sylvain for paving the way -- certainly a
great addition to Org.
* org-macs.el (org-no-properties): Allow a new parameter
`restricted' to restrict the properties removal to those in
`org-rm-props'. The default is now to remove all properties.
* org-compat.el (org-substring-no-properties): Remove unused
defun.
* org-remember.el (org-remember-apply-template): Remove
redundant removal of text properties.
(org-remember-apply-template): Use `org-no-properties'.
* org-capture.el (org-capture-fill-template): Remove redundant
removal of text properties.
(org-capture-fill-template): Use `org-no-properties'.
* org-gnus.el (org-gnus-open, org-gnus-follow-link): Use
`org-no-properties'.
* org-feed.el (org-feed-format-entry): Require `org-capture'.
Expand Elisp %(...) templates.
(org-feed-default-template): Update docstring.
* org-capture.el (org-capture-expand-embedded-elisp): New
function.
(org-capture-fill-template): Use it.
(org-capture-inside-embedded-elisp-p): New function to tell if
we are within an Elisp %(...) template.
* org-capture.el (org-capture-string): New command to prompt
for the interactive text interactively. This can also be used
in Elisp programs to use ̀org-capture' with some initial text.
(org-capture-initial): New variable to store the initial text.
(org-capture): Use `org-capture-initial'.
* org-capture.el (org-capture-templates): Docstring clean up.
(org-capture-place-entry, org-capture-place-item)
(org-capture-place-plain-text, org-capture-place-table-line):
Ensure to always position the point according to %?.
Thanks to Gsqual for reporting this and to Nick Dokos for digging into this
issue.
* org-capture.el (org-capture-templates): New template %l to
insert the literal link pointing at the current buffer.
* org.texi (Template expansion): Document the new %l template.
Thanks to Eric Abrahamsen for this idea.
* org.texi (Using capture): Mention the
`org-capture-last-stored' bookmark as a way to jump to the
last stored capture.
* org-capture.el (org-capture-bookmark): New option.
(org-capture-finalize): Use it.
* org-capture.el (org-capture-fill-template): Use %\n instead of %n as a
template element to be replaced with the nth prompted string.
(org-capture-templates): Update docstring.
* org.texi (Template expansion): Update doc to reflect change.
Using %n triggers errors when the template contains escaped strings,
which happens a lot with links.
* lisp/org-capture.el (org-capture-place-entry): Place captured entry
immediately after last subheading of target, instead of just before
next heading at same level as target.
* lisp/org-capture.el (org-capture-templates): Document new capture
template properties.
* lisp/org-capture.el (org-capture-place-entry,
org-capture-empty-lines-before): Make new :empty-lines-before property
override :empty-lines when inserting empty lines before captured
captured entry.
* lisp/org-capture.el (org-capture-finalize,
org-capture-empty-lines-after): Make new :empty-lines-after property
override :empty-lines when inserting empty lines after captured
captured entry.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.
This commit also bumps the version number to 7.8.06.
The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.
This commit reverts back the maint branch to its state before
merging the master branch. From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
* org-capture.el (org-capture-place-item): Don't search for
position in existing list if :exact-position was supplied.
This fixes a bug reported by François Pinard in
<http://thread.gmane.org/gmane.emacs.orgmode/49995>.
Rename `org-on-heading-p' and `org-on-target-p' to
`org-at-heading-p' and `org-at-target-p' to be more
consistent with the org-at-*-p family.
Also define two aliases.
* lisp/org-capture.el (org-capture-set-target-location): Set the capture
default time also to the prompt time.
In the file+datetree+promt target type, the user is being asked for a
date, where to file an entry. In the template, there can the escape
placeholders for active and inactive time stamps. So far, these were
filled with todays date. This patch changes this behavior, so that
also at %t and %u escaped, the date entered at the prompt will be
used.
Reported by Erik Hetzner.
* org-capture.el (org-capture-before-finalize-hook): Docstring
improvement: mention that the buffer is widened when this hook
is run.
Thanks to Paul for a suggestion about this.
Robert Pluim <rpluim@gmail.com> writes:
> Hi, I'm using XEmacs 21.5 (beta29) "garbanzo" d27c1ee1943b+ [Lucid]
> (i686-pc-cygwin, Mule) of Mon Oct 18 2010 on RPluim, with the following
> org-capture-templates
>
> (("t" "Todo" entry (file+headline "~/org/notes.org" "Tasks") "* TODO %?"))
>
> The problem is that for some reason the resulting TODO heading is has 2
> extra spaces, and is placed at too deep a level, giving:
>
> * Tasks
> *** TODO a task
>
> I've tested this on a fairly recent emacs24 build, and everything works
> fine there, so this is probably something XEmacs specific. Can anyone
> suggest any way to track this down (I'd bisect, but I've yet to find a
> 'good' version)?
I finally got around to looking into this: The reason is that, in
org-capture mode, `outline-level' is bound to outline.el's function,
which is off by one compared to org-mode's. I used this patch to fix
it:
Could somebody review and maybe apply this?
Additionally, replace one
(or (org-mode-p) (derived-mode-p 'org-mode))
with
(derived-mode-p 'org-mode)
cause that is reflexive anyway (returns true, if the current mode is
org-mode).
Delete one check testing for org-mode or org derived mode
Also remove blank lines before the ";;; org*el ends here" declarations.
Having a "Version" header forced us to update every file when releasing a
new version of Org; it also forced us to update every file when merging Org
with Emacs trunk, thus cluttering the diffs between the previously merged
version and the new one with useless information.
Glenn Morris suggested this in emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00322.html
* org-capture.el (org-capture-templates): docstring fix.
* org.texi (Template expansion): order template sequences in
the proper order.
Thanks to Philipp Möller for this fix.
* 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.