* lisp/org-capture.el (org-capture-place-item): When there is no list
to augment, insert new list after planning info and properties
drawers.
* testing/lisp/test-org-capture.el (test-org-capture/item): Add tests.
Reported-by: Allen Li <darkfeline@felesatra.moe>
<http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00060.html>
* lisp/org-capture.el (org-capture-fill-template): Prevent raising an
error when template is an empty entry.
* testing/lisp/test-org-capture.el (test-org-caputre/entry): Add test.
Reported-by: Roland Everaert <reveatwork@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00019.html>
* lisp/org-clock.el (org-clock-out):
* lisp/org.el (org-evaluate-time-range):
Avoid double-rounding of time-related values. Simplify.
* lisp/org-clock.el (org-resolve-clocks-if-idle):
Use time-since instead of open-coding most of it.
* lisp/org-agenda.el (org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-table.el (org-table-sum):
* lisp/org.el (org-babel-load-file, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now):
Simplify.
Note(km): Many of the changes from 476066e89 have been dropped for
compatibility with older Emacsen.
Avoid some double-rounding of Lisp timestamps
476066e89d6f0bb87220da690b8a476bf9655b80
Paul Eggert
Fri Feb 22 18:33:57 2019 -0800
* lisp/org-capture.el (org-capture-place-table-line): Remove
unnecessary call to `org-table-align', which could insert a spurious
newline character.
Reported-by: Thomas Holst <Thomas_Holst@gmx.de>
<http://lists.gnu.org/r/emacs-orgmode/2019-01/msg00233.html>
* lisp/org-capture.el (org-capture-finalize): Do not save the target
capture file if :no-save keyword is non-nil in the capture template.
* doc/org-manual.org (Template elements),
lisp/org-capture.el (org-capture-templates): Document :no-save.
Ref: https://lists.gnu.org/r/emacs-orgmode/2018-09/msg00325.html
* lisp/org-capture.el (org-capture-place-entry): Store position at the
beginning of the capture entry, not at its end.
* testing/lisp/test-org-capture.el (test-org-caputre/entry): Add test.
* lisp/org-capture.el (org-capture-place-plain-text): Fix plain
capture at the end of the buffer.
* testing/lisp/test-org-capture.el (test-org-capture/plain): New test.
* lisp/org-capture.el (org-capture-place-entry): Fix delimiters for
region to delete when aborting capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
* lisp/org-capture.el (org-capture-place-entry): Carefully narrow
buffer to not alter following headline. Also include leading empty
lines in region to remove when cancelling capture.
* testing/lisp/test-org-capture.el (test-org-caputre/entry): New test.
(test-org-capture/abort): Rename test.
Reported-by: Martin Yrjölä <martin.yrjola@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00256.html>
* lisp/org-capture.el (org-capture-finalize): Possibly update formula
when inserting the captured rows in the table.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): Add
tests.
Reported-by: "Holst Thomas (PS-EC/ESE4)" <Thomas.Holst@de.bosch.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00276.html>
* lisp/org.el (org-read-property-value):
* lisp/org-capture.el (org-capture-fill-template): Sidestep
`org-set-property'. Use previous function and `org-entry-put'
instead.
Reported-by: Eric Danan <eric.danan@u-cergy.fr>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00061.html>
* lisp/org-capture.el (org-capture-place-table-line): Fix error when
a precise location is given, e.g. with `file+function' target.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): Add
test.
Reported-by: Thomas Holst <thomas_holst@gmx.de>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00359.html>
* lisp/org-capture.el (org-capture-member): Make obsolete; the old
definition was identical to ‘org-capture-get’ anyway.
(org-capture-mode-map): Move the calls to ‘define-key’ up to where the
variable is defined.
(org-capture-mode-hook): Small docstring tweak.
(org-capture-mode): Fix typo in mode lighter.
(org-capture-set-target-location, org-capture-place-item):
(org-capture-place-plain-text, org-capture-narrow):
(org-capture-empty-lines-after):
(org-capture-import-remember-templates): ‘if’ without else -> ‘when’
* lisp/org-colview.el (org-columns-edit-value): Change an error to a
user-error.
(org-columns-uncompile-format): Improve docstring.
* lisp/org-compat.el (org-remove-from-invisibility-spec): Make
obsolete, the underlying emacs function exists since 1997, commit 31aa282e.
(org-in-invisibility-spec-p, org-count-lines): ‘if’ without else -> ‘when’.
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-entities.el (org-entities-create-table):
* lisp/org-list.el (org-insert-item):
* lisp/org-macs.el (org-with-point-at, org-base-buffer):
(org-preserve-local-variables, org-overlay-display):
(org-overlay-before-string): ‘if’ without else -> ‘when’.
* lisp/org-eshell.el (org-eshell-open): Fix docstring typo.
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/language):
(pcomplete/org-mode/file-option/startup):
(pcomplete/org-mode/file-option/options):
(pcomplete/org-mode/file-option/infojs_opt):
(pcomplete/org-mode/link, pcomplete/org-mode/tex):
(pcomplete/org-mode/todo, pcomplete/org-mode/searchhead):
(pcomplete/org-mode/tag, pcomplete/org-mode/prop): Avoid the formerly
misspelled ‘pcomplete-uniqify-list’ function. It has a defalias in
emacs >= 27; we add our own for older emacsen.
(pcomplete/org-mode/file-option/bind): ‘if’ without else -> ‘when’.
* lisp/org-protocol.el (org-protocol-capture):
(org-protocol-convert-query-to-plist): ‘if’ without else -> ‘when’.
(org-protocol-do-capture): Pacify byte compiler, simplify conditional
logic.
* lisp/org-table.el (org-table-create-with-table.el): Simplify conditional
logic.
(org-table-create, org-table-convert-region, org-table-next-field):
(org-table-beginning-of-field, org-table-end-of-field):
* lisp/org-w3m.el (org-w3m-copy-for-org-mode): ‘if’ without else ->
‘when’.
* lisp/org.el (org-babel-do-load-languages, org-previous-link):
(org-refile): Use ‘(foo ...)’ instead of ‘(funcall 'foo ...)’.
(org-add-log-note): Convert a long cond into a cl-case.
(org-priority): Improve docstring, show a deprecation warning if the
‘show’ argument is passed (which was previously silently ignored).
Also, use ?\s instead of ?\ as a character literal for space.
(org-fast-tag-insert): Fix docstring typo.
(org-fill-element): ‘if’ without else -> ‘when’.
(org-on-target-p): Remove ancient compatibility alias.
* lisp/org-capture.el (org-mks): Moved to org-macs.el.
* lisp/org-macs.el (org-mks): Added from org-capture.el.
The move is being done to accommodate the usage of org-mks in other
Org libraries.
* lisp/org-capture.el (org-capture-finalize): Refresh clock mode line.
* lisp/org-clock.el (org-clock--mode-line-heading): New function.
(org-clock-get-clock-string): Small refactoring.
(org-clock-update-mode-line): Add optional argument. Use new function.
(org-clock-in): Use new function.
* lisp/org-capture.el (org-capture--prompt-history-table):
(org-capture--prompt-history): New variables.
(org-capture-fill-template): Handle history list per prompt.
Reported-by: Karl Eichwalder <ke@gnu.franken.de>
<http://lists.gnu.org/r/emacs-orgmode/2017-11/msg00251.html>
* lisp/org-capture.el (org-capture-mark-kill-region): Set end marker
insertion type so that it advances when inserting text at the end of
the capture buffer.
* testing/lisp/test-org-capture.el (test-org-capture/insert-at-end-abort):
Add test case.
Inserting text at the end of the capture buffer does not advance the
end kill marker. This causes the narrowing region and the kill
markers to get out of sync, which prevents 'org-capture-finalize' from
correctly cleaning the target buffer when aborting the capture.
Setting the kill end marker insertion type fixes this.
TINYCHANGE
* lisp/org-capture.el: (org-capture-fill-template) Fix interactive
timestamp entry to match the behavior of org-time-stamp. This fixes
a bug related to the %^t and %^u template escapes which resulted in
incorrect timestamps (<2017-10-06 Fri-12:00>). The difference
between %^t and %^T now corresponds to the difference between
org-time-stamp called without and with a prefix argument.
* lisp/org-capture.el: (org-capture-place-entry) Ensure that level is
set to 1 (i.e., the top level) if there is no headline target
defined. Otherwise, captured items are improperly nested by context.
* lisp/org-capture.el (org-capture-templates): Make explicit that the time
stamp aware %-escapes are influenced by `org-capture-use-agenda-date'.
TINYCHANGE
* lisp/org-capture.el (org-capture-fill-template): Fix link returned
by %K. Also, both %k and %K should be expanded as strings even when
there is no clocking data.
Reported-by: Michal Politowski <mpol@meep.pl>
* lisp/org-capture.el (org-capture-place-entry): Make sure planning
line is visible when added in a narrowed capture buffer. Refactor
code.
Reported-by: Detlef Steuer <steuer@unibw-hamburg.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113756>
* lisp/org-capture.el (org-capture-finalize): Remove blank lines
number fix, which only applies to narrowed capture buffers.
(org-capture-insert-template-here):
(org-capture-place-plain-text):
(org-capture-place-item):
(org-capture-place-entry): Do not hard-code number of blank lines
after entry.
Reported-by: Igor Perepelytsya <igorquail@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113093>
Reported-by: Jay Dresser <jay@jaydresser.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/113449>
* lisp/org-capture.el (org-capture--clipboards): New variable.
(org-capture-fill-template): Use new variable.
Reported-by: Allen Li <darkfeline@felesatra.moe>
<http://permalink.gmane.org/gmane.emacs.orgmode/113020>
* 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.