Commit Graph

401 Commits

Author SHA1 Message Date
Paul Eggert 74bf99502d Backport commit 988e37fa0 from Emacs
* lisp/org-agenda.el (org-agenda-get-timestamps, org-agenda-get-progress)
(org-agenda-show-clocking-issues):
* lisp/org-capture.el (org-capture-set-target-location):
* lisp/org-clock.el (org-clock-get-sum-start):
* lisp/org.el (org-current-time, org-store-link)
(org-read-date, org-read-date-display)
(org-display-custom-time, org-timestamp-to-time)
Simplify use of encode-time.
* lisp/org-clock.el (org-clock-in, org-clock-update-time-maybe):
* lisp/org-colview.el (org-columns--age-to-minutes):
* lisp/org-macs.el (org-2ft):
* lisp/org.el (org-get-scheduled-time, org-get-deadline-time)
(org-add-planning-info, org-time-string-to-absolute)
(org-closest-date):
Use org-time-string-to-time instead of doing it by hand with
encode-time.
* lisp/org.el (org-read-date): Avoid extra trip through encode-time.

Simplify use of encode-time
988e37fa0f922b852715671d59a0e3f682373411
Paul Eggert
Sun Feb 10 23:54:35 2019 -0800

Note(km): org-current-time has been modified to use org-time-subtract
and org-time-less-p for backward compatibility.  Some changes from
988e37fa0 have been dropped to keep encode-time's call compatible with
older Emacsen.
2019-08-18 17:36:13 -04:00
Paul Eggert 08c7bbbf71 Backport commit a5b796a87 from Emacs
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
Omit unnecessary ‘?’ after nullable pattern.
* lisp/org-capture.el (org-capture-fill-template):
Match upper-case as well as lower-case letters.

Fix 2019-08-04 regex lint
a5b796a8798a809044d847568e6472cc5eca077e
Paul Eggert
Sun Aug 4 11:39:54 2019 -0700
2019-08-17 09:45:22 -04:00
Ismail S 64262af685 Backport commit fb48eb48f from Emacs
* lisp/org-capture.el (org-capture-templates): Fix typo in doc
string (bug#36491).

Fix minor typo in org-capture-templates
fb48eb48f3bd432307821bc7158d1090f0e4bbf0
Ismail S
Tue Jul 9 00:53:18 2019 +0200

TINYCHANGE
2019-07-14 11:12:33 -04:00
Nicolas Goaziou 6efe53cf0b org-capture: Do not break planning when capturing items
* 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>
2019-04-09 09:23:00 +02:00
Nicolas Goaziou b913b7404b org-capture: Fix capture on empty entries
* 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>
2019-04-02 22:10:50 +02:00
Paul Eggert a6cead0d21 Backport commit 476066e89 from Emacs
* 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
2019-03-03 22:49:42 -05:00
Nicolas Goaziou b70cb5b7d0 org-capture: Fix item capture
* 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>
2019-01-17 14:47:07 +01:00
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou 5949d9352b org-capture: Tiny refactoring
* lisp/org-capture.el (org-capture): Use `when' instead of one-armed
  `if'.  Use `error-message-string' when possible.
2018-12-18 09:40:58 +01:00
Kaushal Modi a60a0edc6f Add :no-save keyword for Org capture templates
* 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
2018-12-13 14:09:39 -05:00
Kaushal Modi 54123cd7f2 Revert "org-capture: Do not save buffer when running `org-capture-finalize'"
This reverts commit b4422add37.

Revert the regression in Org capture + auto-saving behavior.

Ref: https://lists.gnu.org/r/emacs-orgmode/2018-09/msg00325.html
2018-12-13 10:11:25 -05:00
Allen Li 601f373e3f Document %i prefix in capture templates
* doc/org-manual.org (Template expansion): Fix documentation.
* lisp/org-capture.el (org-capture-templates): Fix docstring.
2018-12-09 23:34:20 +01:00
Nicolas Goaziou e9108043e1 org-capture: Fix %i with prefix containing "\\"
* lisp/org-capture.el (org-capture-fill-template): Fix %i with prefix
  containing "\\".
* testing/lisp/test-org-capture.el (test-org-capture/fill-template):
  Add test.
2018-12-08 11:49:10 +01:00
Nicolas Goaziou 1d60d5ee03 org-capture: Correctly store position of captured entry
* 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.
2018-12-06 15:07:03 +01:00
Nicolas Goaziou 17e28d6467 org-capture: Various fixes to item capture
* lisp/org-capture.el (org-capture-place-item): Rewrite function.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
(test-org-capture/item): New test.
2018-10-23 23:27:28 +02:00
Nicolas Goaziou 9dbd2993f6 org-capture: Tiny refactoring
* lisp/org-capture.el (org-capture-place-entry): Tiny refactoring.
2018-10-23 01:53:18 +02:00
Nicolas Goaziou b46d4e7b1c org-capture: Remove unnecessary checks
* lisp/org-capture.el (org-capture-place-plain-text): Remove
  unnecessary checks.
2018-10-23 01:46:57 +02:00
Nicolas Goaziou c76486d4e4 org-capture: Fix off-by-one error
* lisp/org-capture.el (org-capture-place-table-line): Fix narrowing.
2018-10-23 01:32:55 +02:00
Nicolas Goaziou 7a4a10dea0 org-capture: Fix plain capture at the end of the buffer.
* 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.
2018-10-23 01:26:17 +02:00
Nicolas Goaziou ad0fce50eb org-capture: Small fix to table line capture
* lisp/org-capture.el (org-capture-place-table-line): Handle abort
  table line insertion more gracefully.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add tests
2018-10-23 00:43:59 +02:00
Nicolas Goaziou aaa3372b8b org-capture: Fix capture aborting
* 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.
2018-10-22 23:40:49 +02:00
Nicolas Goaziou 0fa8bb4c51 org-capture: Inserting an entry doesn't break structure
* 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>
2018-10-22 22:22:21 +02:00
Nicolas Goaziou fa3dab48d0 org-capture: Save buffer in `org-capture-refile'
* lisp/org-capture.el (org-capture-refile): When :kill-buffer option
  is active, save buffer before killing it.

Reported-by: Andrew Burgess <andrew.burgess@embecosm.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-09/msg00052.html>
2018-09-15 16:56:35 +02:00
Nicolas Goaziou 9b7191001c org-capture: Silence byte-compiler 2018-06-21 18:13:31 +02:00
Nicolas Goaziou 031c53103a org-capture: Fix formulas when capturing rows
* 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>
2018-06-21 18:09:40 +02:00
Nicolas Goaziou 547b431e70 org-capture: Fix row insertion in a table with a formula
* lisp/org-capture.el (org-capture-place-table-line): Insert new row
  above the formula, not below.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): Add
  test.
2018-06-21 12:17:07 +02:00
Nicolas Goaziou 7fbb705d13 org-capture: Do not force newline on empty capture templates
* lisp/org-capture.el (org-capture-fill-template): Do not force
  newline on empty capture templates.

Reported-by: xristos <xristos@sdf.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00052.html>
2018-06-19 16:38:09 +02:00
Nicolas Goaziou 54abd0f0ea org-capture: Fix last commit
* lisp/org-capture.el (org-capture-fill-template): Properly handle
  allowed values when target sets them.
2018-06-16 23:15:34 +02:00
Nicolas Goaziou 42a2c248eb org-capture: Fix completion for properties in capture buffer
* 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>
2018-06-16 17:03:22 +02:00
Nicolas Goaziou 9d51a8b5a0 org-capture: Fix table line capture with custom location
* 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>
2018-05-17 22:57:49 +02:00
Nicolas Goaziou 13fb6a3fae Move obsolete declarations into "org-compat.el" 2018-05-10 15:41:50 +02:00
Aaron Ecay 7106eab974 Many small code improvements
* 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.
2018-05-10 04:22:30 +01:00
Nicolas Goaziou 0dda9bf1c1 Mark `org-get-indentation' as obsolete
* lisp/org-macs.el (org-get-indentation): Move function...
* lisp/org-compat: ... here.
* lisp/ob-core.el (org-babel-demarcate-block):
(org-babel-insert-result):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
* lisp/org-capture.el (org-capture-place-item):
* lisp/org-clock.el (org-clock-in):
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-feed.el (org-feed-format-entry):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-list.el (org-in-item-p):
(org-list-struct):
(org-list-struct-apply-struct):
(org-list-item-body-column):
(org-toggle-item):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-fixup-indentation):
(org-cdlatex-environment-indent):
(org--get-expected-indentation):
(org-indent-region):
(org-toggle-fixed-width):
* lisp/ox.el (org-export-expand-include-keyword): Use
  `current-indentation' instead.
2018-05-09 01:26:31 +02:00
Nicolas Goaziou 5c12c21a73 org-capture: Narrow to current captured row
* lisp/org-capture.el (org-capture-place-table-line): Narrow to
  current captured row and obey :unnarrowed property, like every other
  target type.
2018-04-30 11:42:01 +02:00
Nicolas Goaziou cbb48611ef org-capture: Fix aborting a captured row
* lisp/org-capture.el (org-capture-place-table-line): Add missing
  `org-capture-mark-kill-region'.
2018-04-30 01:01:54 +02:00
Nicolas Goaziou ab53ee2c3d org-capture: Fix capturing in a table
* lisp/org-capture.el (org-capture-place-table-line): Rewrite function.
* testing/lisp/test-org-capture.el (test-org-capture/table-line): New
  test.
2018-04-30 00:52:57 +02:00
Nicolas Goaziou 02e290d1d4 Merge branch 'maint' 2018-04-21 15:22:53 +02:00
Nicolas Goaziou cb63ccb78e org-capture: Fix error on capture abort
* lisp/org-capture.el (org-capture-finalize): Do not set `abort-note'
  to `dirty' too easily.

Reported-by: Brad Knotwell <bknotwell@yahoo.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00183.html>
2018-04-21 15:21:25 +02:00
Nicolas Goaziou c1ebb6d221 Merge branch 'maint' 2018-04-21 11:26:54 +02:00
Nicolas Goaziou c75c574d58 org-capture: Fix error when clipboard is empty
* lisp/org-capture.el (org-capture-fill-template): Fix "%x"
  placeholder when clipboard is empty.

Reported-by: Brady Trainor <mail@bradyt.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00328.html>
2018-04-21 11:25:46 +02:00
Nicolas Goaziou 4d152b994e Rewrite tags setting functions
* lisp/org.el (org-setting-tags): Remove variable.
(org-set-tags-command): Change signature.  For interactive use only.
(org-set-tags-to): Remove function.
(org-align-all-tags): Remove function.
(org-align-tags): New function.
(org-set-tags): Change signature.  For non-interactive use only.
(org-promote):
(org-demote):
(org-refile):
(org-todo):
(org-priority):
(org-toggle-tag):
(org-entry-put):
(org-fix-tags-on-the-fly):
(org-ctrl-c-ctrl-c):
(org-delete-indentation):
(org-return):
(org-kill-line): Apply signature change.  Use new functions.
* lisp/ox-beamer.el (org-beamer-property-changed):
(org-beamer-select-environment): Apply signature change.  Use new
functions.
* testing/lisp/test-org-archive.el (test-org-archive/to-archive-sibling):
  Update test.
* testing/lisp/test-org.el (test-org/set-tags): Add tests.
(test-org/set-tags-command): New test.
(test-org/set-tags-to): Remove test.
2018-04-20 10:51:21 +02:00
Feng Shu b4422add37 org-capture: Do not save buffer when running `org-capture-finalize'
* lisp/org-capture.el (org-capture-finalize): Do not run
  `save-buffer'.
2018-04-16 12:11:00 +02:00
Nicolas Goaziou 52ba1a27ad Merge branch 'maint' 2018-04-11 23:03:01 +02:00
Nicolas Goaziou d20fc4d7c5 org-capture: Properly handle `org-extend-today-until' in templates
* lisp/org-capture.el (org-capture-set-target-location): Handle
  non-default `org-extend-today-until'.

Reported-by: Robert Irelan <rirelan@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00023.html>
2018-04-11 23:01:16 +02:00
Rasmus 06ab656f42 org-macs: Move org-mks from org-capture to org-macs
* 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.
2018-04-07 13:03:18 +02:00
Bastien 8548dfa33f Merge branch 'maint' 2018-03-20 12:38:31 +01:00
Bastien b2d3dbabf7 org-capture.el: Fix docstring
* lisp/org-capture.el (org-capture-templates-contexts): Fix docstring.
2018-03-20 12:38:24 +01:00
Nicolas Goaziou 0de818964d Merge branch 'maint' 2018-03-11 19:22:25 +01:00
Nicolas Goaziou 2f587d496f org-capture: Prevent spurious blank line during capture
* lisp/org-capture.el (org-capture-place-entry): Prevent spurious
  blank line during capture.

Reported-by: Luke <mideniko1234-org@yahoo.co.uk>
<http://lists.gnu.org/r/emacs-orgmode/2018-03/msg00075.html>
2018-03-11 19:21:29 +01:00
Nicolas Goaziou 6e10c268de Merge branch 'maint' 2018-02-24 22:01:32 +01:00