Commit Graph

892 Commits

Author SHA1 Message Date
Dan Drake 554a3fc643 org-clock.el: Add `t' option to `org-clock-resolve'
* org-clock.el (org-clock-resolve): add `t' option.  This works like
`k', but asks the user to specify a time instead of a number of
minutes.

TINYCHANGE

Often when you are interrupted at a task and get back to it, you know
what time the interruption happened. This option makes it easy to tell
org-resolve-clocks about that. For example, say you clocked into task A
at, say, 9:37:

    * original task A
      :LOGBOOK:
      CLOCK: [2020-01-21 Mon 09:37]
      :END:

While working on task A, you get a phone call. When the call is done,
you'd like to update your time logging to reflect the phone call. Your
phone says the call was at 11:09.

With C-c C-x C-z, you can use the `K' option, but you need to figure out
the number of minutes to keep. It's easier to look at the phone, or to
mentally note the time when an interruption starts. With the new option,
you can select `T', and just specify a time of 11:09. The state is now:

    * original task A
      :LOGBOOK:
      CLOCK: [2020-01-21 Mon 09:37]--[2020-01-21 Mon 11:09] => 1:32
      :END:

You add the phone call to your org buffer and do C-c C-x C-i to clock
in. Org asks you to start the time from when the previous task ended,
you say yes, and the state is now:

    * original task A
      :LOGBOOK:
      CLOCK: [2020-01-21 Mon 09:37]--[2020-01-21 Mon 11:09] => 1:32
      :END:
    * task B, phone call
      :LOGBOOK:
      CLOCK: [2020-01-21 Mon 11:09]
      :END:

At this point, you can clock back into task A, or any other task.

The key feature here is to be able to just type in a time -- in any
format accepted by org-read-date -- instead of specifying a number of
minutes.
2020-02-13 07:48:04 +01:00
Bastien 32a5fa0b6c Revert "org-clock.el: Allow to tell time you got back when resolving"
This reverts commit 57841b5264.
2020-02-13 07:37:49 +01:00
Bastien 57841b5264 org-clock.el: Allow to tell time you got back when resolving
* lisp/org-clock.el (org-clock-resolve): Allow to tell at what
time (i.e. a HH:MM string) you "got back".

Thanks to Dan Drake for suggesting this.
2020-02-13 01:25:26 +01:00
Bastien e3b79ad2bf Allow a new value for `org-adapt-indentation'
* doc/org-manual.org (Hard indentation): Add a footnote
mentioning the new value for `org-adapt-indentation'

* etc/ORG-NEWS: Mention the new value for
`org-adapt-indentation'.

* lisp/org.el (org-logbook-drawer-re): New constant.
(org-adapt-indentation): Allow 'headline-data as a new value
to only adapt indentation for headline data.
(org-fixup-indentation, org--get-expected-indentation): Handle
`org-adapt-indentation' set to 'headline-data.

* lisp/org-indent.el (org-indent-mode)
(org-indent-add-properties): Handle `org-adapt-indentation'
set to 'headline-data.

* lisp/org-clock.el (org-clock-in): Call `org-indent-line'
after clock timestamp insertion.
2020-02-09 17:30:42 +01:00
Bastien a62751a6a5 Add `org-clock-toggle-auto-clockout'
* doc/org-manual.org: Document the new command.

* lisp/org-clock.el (org-clock-toggle-auto-clockout): New
command.
2020-02-09 11:17:42 +01:00
Bastien 88794cab06 New option `org-clock-auto-clockout-timer'
* etc/ORG-NEWS (New option ~org-clock-auto-clockout-timer~):
Mention the new option `org-clock-auto-clockout-timer'.

* doc/org-manual.org (Clocking out automatically after some
idle time): Document `org-clock-auto-clockout-timer'.

* lisp/org.el (org-clock-auto-clockout-insinuate): New
function to add a hook for auto-clocking out the current tasks
after `org-clock-auto-clockout-timer' seconds.

* lisp/org-clock.el (org-clock-auto-clockout-timer): New option.
(org-clock-auto-clockout): New function, use the new option.
2020-02-09 11:05:12 +01:00
Bastien 70ef811001 Silence compiler warning 2020-01-29 15:08:33 +01:00
Kyle Meyer 95a91df825 org-clock: Fix typos in org-show-notification-timeout's docstring
* lisp/org-clock.el (org-show-notification-timeout): Fix docstring
typos.
2020-01-27 23:25:37 -05:00
Bastien 3b87d4ab4f Fix compiler warning
* lisp/org-clock.el (w32-notification-notify): Declare.
2020-01-27 15:17:42 +01:00
Bastien f9c34a7d51 org-clock.el: New option `org-show-notification-timeout'
* lisp/org-clock.el (org-show-notification-timeout): New option.
(org-show-notification): Use `w32-notification-notify' and the new
option.
2020-01-26 17:35:18 +01:00
Bastien b6fc8396a6 Merge branch 'maint' 2020-01-26 17:03:21 +01:00
Bastien a3c373a1bf org-clock.el: Explicitely require 'notifications
* lisp/org-clock.el (org-show-notification): Explicitely require
'notifications and remove w32-related code.
2020-01-26 16:49:11 +01:00
Nicolas Goaziou 4141355492 Merge branch 'maint' 2020-01-26 09:45:28 +01:00
Edward Sillador 8dd2984a94 org-clock.el: Handle notification on windows-nt
* lisp/org-clock.el (org-show-notification): Handle notification
on windows-nt.

TINYCHANGE
2020-01-26 09:09:02 +01:00
Bastien e19eea48a5 org-clock.el: Use `user-error' instead of `error'
* lisp/org-clock.el (org-clock-cancel, org-clock-goto)
(org-clocktable-shift, org-dblock-write:clocktable)
(org-clocktable-write-default): Use `user-error' instead of
`error'.
2020-01-25 20:19:19 +01:00
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Kyle Meyer a01a8f55d8 Merge branch 'maint' 2019-10-27 15:55:30 -04:00
Juanma Barranquero 9c611fd8ac Backport commit 41ba8231e from Emacs
* lisp/ob-scheme.el (org-babel-scheme-get-buffer-impl):
* lisp/ob-shell.el (org-babel--variable-assignments:sh-generic)
(org-babel--variable-assignments:bash_array)
(org-babel--variable-assignments:bash_assoc)
(org-babel--variable-assignments:bash):
* lisp/org-clock.el (org-day-of-week):
(table--put-cell-valign-property): Fix typos.
* lisp/ob-core.el (org-babel-named-src-block-regexp-for-name)
(org-babel-named-data-regexp-for-name): Doc fix.
(org-babel-src-block-names, org-babel-result-names): Fix typos.

lisp/*.el: Fix typos and improve some docstrings
41ba8231ef072571e1a6feabc15d113e5cf57556
Juanma Barranquero
Sun Oct 20 12:12:27 2019 +0200
2019-10-27 15:54:59 -04:00
Michaël Cadilhac 9586db1248 org-clock: Add an option to not show the file column in clock report
* lisp/org-clock.el (org-clocktable-defaults): Add `hidefiles'.
(org-dblock-write:clocktable): Implement not showing files when
`hidefiles' is true.
* lisp/org-pcomplete.el: Add `hidefiles'.
2019-09-05 18:56:28 +02:00
Kyle Meyer c7c04b0447 Merge branch 'maint' 2019-08-18 17:44:08 -04:00
Kyle Meyer 9e1b9fe627 Port more time-related changes
* lisp/org-agenda.el (org-agenda-check-clock-gap):
* lisp/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve-clock, (org-clock-resolve)
(org-resolve-clocks, org-resolve-clocks-if-idle)
(org-clock-in, org-clock-out, org-clock-sum, org-clocktable-steps):
* lisp/org-element.el (org-element-cache-sync-duration)
(org-element--cache-set-timer, org-element--cache-interrupt-p):
(org-element--cache-sync):
* lisp/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-timer.el (org-timer-start):
(org-timer-pause-or-continue, org-timer-set-timer):
* lisp/org.el (org-today, org-auto-repeat-maybe): Port time-related
changes from the Emacs repo by using compatibility wrappers.

In the Emacs repo, there has been a lot of changes to Org files
involving time-related code.  I've ported some of those changes but
have largely ignored any changes that break compatibility with older
Emacsen that we support.  That, however, isn't a good approach because
it will be hard to do a systematic update once we bump our minimum
Emacs requirement.  Instead use the recently added compatibility
wrappers where needed, which is ugly but more maintainable.

The main time-related changes this leaves unported are changes that
replace (apply #'encode-time args) calls with (encode-time args).
Until the first form is unsupported, adding a compatibility function
doesn't seem worth the churn.

Relevant Emacs commits include
c75f505dea6a560b825384cf3d277690f86840bf,
57c74793c46c6533b63836f00aecaf3ac2accb6d,
988e37fa0f922b852715671d59a0e3f682373411,
476066e89d6f0bb87220da690b8a476bf9655b80,
89c63b3522b62c0fd725f0b348927a2069238452.
2019-08-18 17:37:51 -04:00
Kyle Meyer d72b4af96e org-clock: Adjust steps calculation for Emacs 24 compatibility
* lisp/org-clock.el (org-clocktable-increment-day): Use
org-decode-time so that integer can be given for time on Emacs 24.
(org-clocktable-steps): Work with a float rather than internal time to
avoid "Invalid time specification" error on Emacs 24.

This fixes the failure of test-org-clock/clocktable/step on Emacs 24.
Note that the version of org-clocktable-steps on master has been
reworked and does not share this issue.
2019-08-18 17:36:13 -04:00
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
Aaron L. Zeng 1b74ae0ba3 org-clock: Clear org-clock-current-task on clock cancel
* org-mode/lisp/org-clock.el (org-clock-cancel): Clear
`org-clock-current-task' when a clock is canceled.

This variable is used by some mode line packages (e.g.,
spaceline-all-the-icons), so not clearing the variable incorrectly
displays the previous task as ongoing.
2019-06-15 11:53:42 +02:00
Andrii Kolomoiets c103bc5acf org-clock: Fix restore of `frame-title-format`
* lisp/org-clock.el (org-frame-title-format-backup): Use nil as initial value.
(org-clock-in): set `org-frame-title-format-backup' to `frame-title-format'.
(org-clock-restore-frame-title-format): New function.
(org-clock-out): Use it.
(org-clock-cancel): Use it.

The problem was that the `org-frame-title-format-backup' variable is
initialized on org-clock.el loading and future changes to `frame-title-format'
is ignored.

TINYCHANGE
2019-05-28 19:58:52 +02:00
Kyle Meyer c2f3f1912e Merge branch 'maint' 2019-03-17 22:56:24 -04:00
Paul Eggert 7c9bfa142f Backport commit 3739d51ef from Emacs
* lisp/org-agenda.el (org-agenda):
* lisp/org-clock.el (org-clock-out, org-clock-display):
* lisp/org.el (org-refile):
Don’t trust arbitrary strings to not contain "%" or "`" in
(message (concat STRING1 STRING2 ...)).

Be safer about "%" in message formats
3739d51ef3b935b30e40ba4534fe362bc685865f
Paul Eggert
Thu Mar 7 09:05:56 2019 -0800
2019-03-17 22:52:48 -04:00
Nicolas Goaziou c020e92ada Merge branch 'maint' 2019-03-10 21:48:55 +01:00
Nicolas Goaziou cd13b0241d org-clock: Fix :scope for clock table
* lisp/org-clock.el (org-dblock-write:clocktable): Test every scope
  combination before trying to call a function.

Reported-by: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-03/msg00034.html>
2019-03-10 21:47:40 +01:00
Nicolas Goaziou 2b00d62816 Change bracket link escape syntax
* contrib/lisp/org-link-edit.el (org-link-edit--link-data):
* lisp/ob-tangle.el (org-babel-tangle-comment-links): Update match-group.
(org-babel-detangle): Remove unnecessary `org-link-escape' call.
(org-babel-tangle-jump-to-org): Update match group.
(org-link-url-hexify):
(org-link-escape-chars): Remove variables.
* lisp/ol.el (org-link--decode-compound): Renamed from
  `org-link--unescape-compound'.
(org-link--decode-single-byte-sequence): Renamed from
`org-link--unescape-single-byte-sequence'.
(org-link-make-regexps): Update `org-link-bracket-re' syntax.
(org-link-encode): New function, renamed from `org-link-escape'.
(org-link-decode): New function, renamed from `org-link-unescape'.
(org-link-escape):
(org-link-unescape): Use new escape syntax.
(org-link-make-string): Apply new escaping rules.
(org-link-display-format):
(org-insert-link): Update match group.
* lisp/org-agenda.el (org-diary):
(org-agenda-format-item):
(org-agenda-to-appt): Update match group.
* lisp/org-clock.el (org-clocktable-write-default): Update match group.
* lisp/org-element.el (org-element-link-parser): Update match group.
* lisp/org-mobile.el (org-mobile-escape-olp):
(org-mobile-locate-entry): Apply function renaming.
* lisp/org-protocol.el (org-protocol-split-data):
(org-protocol-parse-parameters): Apply function renaming.
* lisp/org.el (org-refile): Update match group.
* testing/README (Interactive testing from within Emacs): Fix
  examples.
* testing/lisp/test-ol.el (test-ol/encode): Merge old escape tests.
(test-ol/decode): Merge old unescape tests.
(test-ol/escape):
(test-ol/unescape):
(test-ol/make-string): New tests.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/link):
* testing/lisp/test-org.el (test-org/custom-id):
(test-org/fuzzy-links):
* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Update
  tests.
2019-03-10 18:00:36 +01:00
Nicolas Goaziou a486d9cbd7 Move link-related core functions out of "org.el"
* contrib/lisp/org-wl.el (org-wl-store-link-message):
* lisp/Makefile (clean-install):
* lisp/ob-core.el (org-link-bracket-re):
(org-babel-open-src-block-result):
(org-babel-read-element):
(org-babel-read-link):
(org-babel-result-end):
* lisp/ob-tangle.el (org-link-bracket-re):
(org-babel-tangle-single-block):
(org-link-analytic-bracket-re):
(org-babel-detangle):
(org-babel-tangle-jump-to-org):
* lisp/ol.el:
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
(org-diary):
(org-agenda-format-item):
(org-agenda-open-link):
(org-agenda-switch-to):
(org-agenda-to-appt):
* lisp/org-bbdb.el (org-bbdb-store-link):
* lisp/org-bibtex.el (org-bibtex-store-link):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clocktable-write-default):
(org-clock-get-table-data):
* lisp/org-compat.el (org-doi-server-url):
(org-email-link-description-format):
(org-make-link-description-function):
(org-from-is-user-regexp):
(org-descriptive-links):
(org-url-hexify-p):
(org-context-in-file-links):
(org-keep-stored-link-after-insertion):
(org-display-internal-link-with-indirect-buffer):
(org-confirm-shell-link-function):
(org-confirm-shell-link-not-regexp):
(org-confirm-elisp-link-function):
(org-confirm-elisp-link-not-regexp):
(org-file-complete-link):
(org-email-link-description):
(org-make-link-string):
(org-store-link-props):
(org-add-link-props):
(org-make-link-regexps):
(org-angle-link-re):
(org-plain-link-re):
(org-bracket-link-regexp):
(org-bracket-link-analytic-regexp):
(org-any-link-re):
* lisp/org-docview.el (org-docview-store-link):
(org-docview-complete-link):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-eshell.el (org-eshell-store-link):
* lisp/org-eww.el (org-eww-store-link):
(org-eww-copy-for-org-mode):
* lisp/org-footnote.el (org-footnote-next-reference-or-definition):
* lisp/org-gnus.el (org-gnus-article-link):
(org-gnus-store-link):
* lisp/org-id.el (org-id-store-link):
* lisp/org-info.el (org-info-store-link):
* lisp/org-irc.el (org-irc-erc-store-link):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead):
* lisp/org-protocol.el (org-protocol-do-capture):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org-w3m.el (org-w3m-store-link):
(org-w3m-copy-for-org-mode):
2019-03-10 18:00:27 +01:00
Nicolas Goaziou 9d7b1ef8a9 Merge branch 'maint' 2019-03-04 17:04:38 +01:00
Nicolas Goaziou 2fb60532cf org-clock: Remove :scope from default clocktable properties
* lisp/org-clock.el (org-clock-clocktable-default-properties):
  Remove :scope.

The :scope value is handled specially in `org-clock-report'.  Setting
it here would override the special mechanism there.

Reported-by: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-03/msg00034.html>
2019-03-04 17:04:26 +01:00
Kyle Meyer cded785a6a Merge branch 'maint' 2019-03-03 22:55:07 -05: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 344ed4c278 Merge branch 'maint' 2019-02-28 14:39:54 +01:00
Marco Wahl e21ad2aea1 org-clock: Fix display of file time
* lisp/org-clock.el (org-clocktable-write-default): Fix format string.
2019-02-28 11:37:08 +01:00
Nicolas Goaziou 38121248c9 Merge branch 'maint' 2019-02-15 00:22:03 +01:00
Nicolas Goaziou f9015b4bbf Fix last commit
* lisp/org-clock.el (org-clock-out-if-current): Autoload function.
* lisp/org.el (org-todo): Do not call `org-clock-out-if-current' if
  `org-clock' is not loaded yet.
2019-02-15 00:20:40 +01:00
Nicolas Goaziou d783422498 Merge branch 'maint' 2019-02-14 15:07:07 +01:00
Nicolas Goaziou 8fc22d464d Fix `org-clock-out-when-done' in a narrowed buffer
* lisp/org-clock.el (org-clock-out-if-current): Ignore narrowing.
* lisp/org.el (org-todo): Call directly previous function instead of
  relying on a hook.

Reported-by: Leo Vivier <leo.vivier@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-02/msg00132.html>
2019-02-14 15:03:37 +01:00
Kyle Meyer 646d4a5fe9 Merge branch 'maint' 2019-01-31 23:04:06 -05:00
Kyle Meyer af7795533a Revert "(current-time) => nil" for Emacs 24 compatibility
* lisp/org-clock.el (org-clock-resolve-clock):
(org-clock-resolve):
(org-resolve-clocks-if-idle):
* lisp/org-element.el (org-element--cache-interrupt-p):
(org-element--cache-sync):
* lisp/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-timer.el (org-timer-show-remaining-time):
* lisp/org.el (org-babel-load-file):
(org-current-time):
(org-today):
(org-auto-repeat-maybe): Revert nil to (current-time) replacement for
compatibility with Emacs 24.

This reverts many changes introduced by eb10ad936 (Backport commit
c75f505de from Emacs, 2017-10-20).

Reported-by: Samuel Wales <samologist@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2019-01/msg00427.html>
2019-01-31 23:03:10 -05:00
Kyle Meyer ba321d0e44 Merge branch 'maint' 2019-01-13 15:14:37 -05:00
Paul Eggert eb10ad9360 Backport commit c75f505de from Emacs
* lisp/org-agenda.el (org-agenda-to-appt):
* lisp/org-clock.el (org-clock-resolve-clock)
(org-clock-resolve, org-resolve-clocks-if-idle):
* lisp/org-colview.el (org-columns-edit-value, org-columns)
(org-agenda-columns):
* lisp/org-element.el (org-element--cache-interrupt-p)
(org-element--cache-sync):
* lisp/org-habit.el (org-habit-get-faces)
(org-habit-insert-consistency-graphs):
* lisp/org-indent.el (org-indent-add-properties):
* lisp/org-timer.el ((org-timer-show-remaining-time):
* lisp/org.el (org-babel-load-file, org-current-time)
(org-today, org-auto-repeat-maybe)
(org-small-year-to-year, org-goto-calendar):
* lisp/ox.el (org-export-insert-default-template):
Use nil instead of (current-time) where either will do, as nil is
a bit more efficient and should have less timing error.

Prefer nil to (current-time) when either works
c75f505dea6a560b825384cf3d277690f86840bf
Paul Eggert
Fri Oct 20 19:42:23 2017 -0700

Note(km): The changes that will reverted in the next commit have been
dropped from the ChangeLog entries above.
2019-01-13 12:43:03 -05:00
Kyle Meyer 9ceb723602 org-clock: Simplify `untilnow' range logic
* lisp/org-clock.el (org-clock-special-range): Use nil to represent
`untilnow'.
* lisp/org-clock.el (org-clocktable-steps): For `untilnow' block, set
set timestamp to 2003.
* doc/org-manual.org (The clock table): Document `untilnow' floor when
used with :step.

For `untilnow', org-clock-special-range sets the start to
"<-50001-11-30 Tue 00:00>", but org-parse-time-string actually assumes
a YYYY-MM-DD format and parses the year as 0001.  By chance, this is
still a really old date, so no one noticed.  However, with the port of
Emacs's fde99c729c (Port recent org-clock fix to POSIX time_t,
2018-03-28), test-org-clock/clocktable/ranges would fail if the system
supports the oldest date tried, "<-67715-09-22 Tue 17:51>".

But this "encode-time -> format-time-string -> org-parse-time-string"
dance is mostly unnecessary.  All the current org-clock-special-range
callers except for org-clocktable-steps (1) explicitly check if the
starting time is nil, (2) don't use the starting time, or (3) pass it
directly to org-clock-sum, which handles nil values.  And
org-clock-sum executes the same codepath when nil is passed instead of
"really old date".

Update org-clocktable-steps to use 2003 (the year Org was created) as
the starting point when org-clock-special-range returns nil for the
starting time.  This is more efficient because we don't needlessly
calculate steps over a large chunk of time that almost certainly
doesn't have any clocked time.  And it won't run into the portability
issues like Emacs's fde99c729c.  2003 _should_ be an appropriate
effective starting date, since we don't expect clocked time before the
existence of Org.  If this turns out to be an issue (e.g., someone
converted reports from a pre-Org and still makes clock tables that
include those times), we can make this value configurable.
2019-01-13 12:41:29 -05:00
Kyle Meyer 6972cce38b Merge branch 'maint' 2019-01-13 00:13:46 -05:00
Kyle Meyer f3584ecc3b org-clock: Correctly locate heading when resolving clock
* lisp/org-clock.el (org-clock-resolve-clock): Store heading location
as marker instead of raw position to ensure that org-clock-in is
called in the correct buffer.

This fixes a regression introduced by 503ede74b (org-clock: Fix
resolving clocks, 2018-12-06).
2019-01-13 00:13:33 -05:00
Kyle Meyer cbc43c1f01 Fix docstring typo
* lisp/org-clock.el (org-clocktable-steps): Fix docstring typo.
2019-01-12 23:46:00 -05:00
stardiviner 34b71a0ca9 Add a dispatcher command for inserting dynamic blocks
* lisp/org.el (org-dynamic-block-insert-dblock,
  org-dynamic-block-alist, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-define,
  org-dynamic-block-function): New variables, New functions.

* lisp/org-keys.el (org-dynamic-block-insert-dblock): Add binding for
  the function.
(org-clock-report, org-columns-insert-dblock): Remove function
keybindings. Mark them as obsolete.

* doc/org-manual.org (Dynamic Blocks): : Add manual for dispatch
command `org-dynamic-block-insert-dblock'.

* testing/lisp/test-org-clock.el: New test.
2019-01-02 15:55:51 +01:00