* doc/org.texi: Document the new capture templates target.
* lisp/org-capture.el (org-capture-upgrade-templates): New function.
(org-capture-templates): Implement the new file+olp+datetree target.
(org-capture): Document the C-1 prefix.
(org-capture-sanitize-olp): New function.
(org-capture-select-template): Make sure upgraded version of templates
variable is used.
* lisp/org-datetree.el (org-datetree-find-date-create): Accept
`subtree-at-point' as a value for the KEEP-RESTRICTION argument.
(org-datetree-find-iso-week-create): Accept `subtree-at-point'
as a value for the KEEP-RESTRICTION argument.
* lisp/org.el (org-find-olp): Throw an error when called in a
buffer that is not in Org mode.
* lisp/org-capture.el (org-capture-fill-template): Use overriding time
also in `?<>' escapes.
* lisp/org-capture.el (org-capture-fill-template): Escape backslash
characters in %i contents when those are inserted within a S-exp.
Also prevent adding any prefix to %i contents spanning over multiple
lines when they are inserted within a S-exp.
* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
Add tests.
Reported-by: Samuel Wales <samologist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112232>
* lisp/org-capture.el (org-capture-refile): Preserve location of point
when refiling.
* testing/lisp/test-org-capture.el (test-org-capture/refile): New
test.
Reported-by: Liu Hui <liuhui1610@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112202>
* lisp/org-capture.el (org-mks): Do not freeze when there is a missing
step in the key hierarchy. Fix docstring. Refactor code for clarity.
Reported-by: Roland Everaert <reveatwork@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/111716>
* lisp/org-capture.el (org-capture-bookmark-last-stored-position):
Rename to ...
(org-capture-store-last-position): ... this. Also store last position
unconditionally.
* lisp/org-capture.el (org-capture-finalize): Apply renaming.
* lisp/org-table.el (org-table-current-column):
(org-table-current-dline): Do not allow to call these functions
interactively. `org-table-field-info' should be used instead.
* lisp/org-capture.el (org-encrypt-entry): Silence byte-compiler.
* lisp/org-capture.el (org-capture-expand-file): Disallow S-exp.
(org-capture-templates):
* doc/org.texi (Template elements): Update documentation.
A function is equivalent to using S-exp, without tainting code with an
yet another call to `eval'.
* lisp/org-capture.el (org-capture-fill-template): Remove history
variable, which is not strictly necessary and relies, in its current
implementation, on dynamic binding.
* lisp/org-capture.el (`org-capture-templates'): Adjust the
`org-capture-templates' defcustom template to support specifying the capture
target file using either a literal pathname, a function, a variable or a
form, as documented. Previously the Customize UI supported specifying only a
literal pathname.
(org-capture-templates): Clarify the documentation for the `function' method
for setting up the capture target.
* doc/org.texi (Template elements): Clarify the `function' method for setting up
the capture target.
* lisp/org-capture.el (org-capture):
(org-mks): Replace `error' with `user-error'.
When `org-capture` is aborted by user with 'q' or 'C-g', `user-error' is
better than `error' when exiting.
TINYCHANGE
* lisp/org-capture.el (org-capture-place-table-line): Move point in
front of the table before trying to analyze it.
Reported-by: Christian Moe <mail@christianmoe.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/106356>
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-feed.el (org-feed-format-entry): Fix handling escaped
placeholders in templates. In particular, do not rely on match data
when `org-capture-escaped-%' is used.
Reported-by: Michael Brand <michael.ch.brand@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/104081>
* lisp/org-capture.el (org-capture-expand-embedded-elisp): Do not mark
invalid sexp. Renamed from `org-capture--expand-embedded-elisp'.
(org-capture-fill-template): Escape " characters for placeholders
located within sexp. Small refactoring.
(org-capture-inside-embedded-elisp-p): Rewrite function.
* lisp/org-capture.el (org-capture-steal-local-variables): Remove function.
(org-capture-fill-template): Apply removal. Use
`org-clone-local-variables' instead. Focus on Org specific variables.
* lisp/org.el (org-get-local-variables):
(org-clone-local-variables): Ignore internal local variables, whose
value is probably tied to their respective buffer. In particular, this
prevents cache related variables from being copied.
* lisp/org-indent.el (org-indent--initial-marker): Renamed from
`org-indent-initial-marker'. Marking it as internal prevents it from
being copied by `org-clone-local-variables' and alike.
(org-indent-mode):
(org-indent-initialize-buffer): Apply renaming.
* lisp/org-capture.el (org-capture-is-refiling): New variable.
(org-capture-place-template): Silence byte-compiler.
* lisp/org.el (org-refile): Use new variable.
* lisp/org-capture.el (org-capture-templates): Update docstring.
(org-capture-fill-template): Expand interactive placeholders when the
template is otherwise completely filled.
This restores the previous behaviour for template's expansion.
* lisp/org-capture.el (org-capture-fill-template): Allow more than one
word when filling %{prompt} place holders.
Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/103251>
* lisp/org-capture.el (org-capture-templates): Improve docstring.
(org-capture-fill-template): Prevent recursive evaluation of %(...)
placeholders. Fix escaping of % character in templates.
* testing/lisp/test-org-capture.el: New file.
Reported-by: Thomas Preindl <thomas.preindl@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103018>
* org-capture.el (org-capture-refile): Call finalize first, then
refile. If the capture buffer needs to be killed afterwards, kill
after refiling.
Refiling before finalizing led to an incorrect cursor position during
refile. Since adjusting the buffer position and bounds for the refiled
entry is difficult, I reverted the `org-capture-refile' function to its
original order of finalizing and then refiling. However, this leads to
a bug with killing the buffer on capture, described in
<http://permalink.gmane.org/gmane.emacs.orgmode/78027/>. To work around
this, now the :kill-buffer flag is cleared before calling finalize, and
the capture buffer is killed after `org-refile' is called.
TINYCHANGE
These changes are in line with the changes proposed on the mailing list,
but many of those changes weren't necessary because they had already
been reverted in the Emacs repo.
<http://permalink.gmane.org/gmane.emacs.orgmode/100896/>
These changes are the combination of the commits below (in order
applied). Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits. Changes to message and help quote
display for Emacs 25 seem to be here to stay. The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.
Quoting fixes in lisp/org
6cd2629bd1b3ce77d29ac28e29237c94a4197116
Paul Eggert
Mon Aug 31 00:29:40 2015 -0700
More-conservative ‘format’ quote restyling
fbb5531fa11d13854b274d28ccd329c9b6652cfc
Paul Eggert
Sun Aug 23 22:39:06 2015 -0700
Prefer directed to neutral quotes
875a5d0ead827d3da32ecbd30e739a29f07bbc87
Paul Eggert
Mon Aug 24 23:57:25 2015 -0700
Escape ` and ' in doc
19532d147b431a4fe34f088d6de07891c48e2c5c
Paul Eggert
Tue Sep 1 18:23:21 2015 -0700
Fix some more docstring etc. quoting problems
26bd978d87dfbf9baa115cd961a67d42b416c4bf
Paul Eggert
Thu Sep 3 15:32:54 2015 -0700
Go back to grave quoting in source-code docstrings etc.
6afef3f6ca2f3009c722b84e249903b7f807b044
Paul Eggert
Mon Sep 7 16:09:27 2015 -0700
* lisp/org-table.el (org-table-auto-recalculate-regexp):
(org-table-recalculate-regexp):
(org-table-calculate-mark-regexp):
(org-table-column-names):
(org-table-column-name-regexp):
(org-table-local-parameters):
(org-table-named-field-locations):
(org-table-current-line-types):
(org-table-current-begin-pos):
(org-table-current-ncol):
(org-table-dlines):
(org-table-hlines): Improve docstrings.
(org-table-current-begin-line): Remove variable.
(org-table-save-field): New macro.
(org-table-get-specials): Remove function.
(org-table-analyze): New function, renamed from
`org-table-get-specials'.
(org-table-find-row-type): Remove function.
(org-table--row-type): New function, renamed from
`org-table-find-row-type'.
(org-table-align): Use new macro.
(org-table-field-info):
(org-table-insert-column):
(org-table-delete-column):
(org-table-move-column):
(org-table-sort-lines):
(org-table-paste-rectangle):
(org-table-wrap-region):
(org-table-current-field-formula):
(org-table-get-formula):
(org-table-maybe-recalculate-line):
(org-table-eval-formula):
(org-table-get-range):
(org-table--descriptor-line):
(org-table-recalculate):
(org-table-expand-lhs-ranges):
(org-table-edit-formulas):
(org-table-show-reference):
(org-table-get-remote-range): Apply changes above. Refactor code.
(org-table-check-inside-data-field):
(org-table-current-column):
(org-table-current-dline):
(org-table-line-to-dline):
(org-table-copy-region):
(org-table-rotate-recalc-marks):
(org-table-fedit-post-command):
(org-table-fedit-convert-buffer):
(org-table-highlight-rectangle): Refactor code.
(org-table-goto-field): New function.
* lisp/org-capture.el (org-capture-place-table-line): Apply change made
to table internals.
The point of this commit is to remove dependency on `org-current-line'
and `org-goto-line', which are both expensive in large buffers. Now,
lines are relative to the beginning of the current table instead of
global (i.e., relative to the beginning of the buffer).
* 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.