* 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.