* lisp/org-colview.el (org-columns-compute-all):
* lisp/org-timer.el (org-timer-start):
(org-timer-pause-or-continue):
(org-timer-seconds):
* lisp/org.el (org-read-date-analyze): Favor nil argument to
explicitly passing current-time result to float-time and decode-time.
Most of these "(current-time) => nil" changes were made in the Emacs
codebase, but we stayed with the original state because we relied on
explicitly overriding current-time in the tests. As of the last
commit, we no longer need to do this and can use org-test-at-time
instead.
* lisp/org-colview.el (org-columns-compute-all):
* lisp/org-timer.el (org-timer-start):
(org-timer-pause-or-continue):
(org-timer-seconds):
(org-timer-set-timer):
* lisp/org.el (org-read-date-analyze): Restore use of `current-time`
for testing purposes.
In these spots, we call (current-time) so that it can be overriden in
tests. Add a comment about this in the cases that don't have one.
* 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.
* 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.
* lisp/org-colview.el (org-columns--displayed-value): Add new optional
argument.
(org-columns--collect-values): Use new argument when called from
Agenda mode.
Reported-by: Allen Li <darkfeline@felesatra.moe>
<http://lists.gnu.org/r/emacs-orgmode/2018-12/msg00040.html>
* lisp/org-colview.el (org-columns--capture-view): Add parameter.
(org-dblock-write:columnview): Add new property.
* doc/org-manual.org (Capturing column view): Document feature.
* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add
test.
This addition allows to specify a list of tags to exclude from column
view tables.
TINYCHANGE
* lisp/org-colview.el (org-columns--summary-apply-times): Use the same
rule as everywhere else in Org.
* doc/org-manual.org (Column attributes): Document change.
Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00294.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.
* org-colview.el (org-columns--capture-view): New
argument "match" to filter out unmatched entries.
(org-dblock-write:columnview): Use the new argument.
Thanks to Thierry Stoehr for proposing this.
* lisp/org-colview.el (org-columns-remove-overlays): Fix
"wrong-type-argument markerp nil".
When calling `org-agenda-columns', `org-columns-top-level-marker' is
not set. Handle this situation.
Reported-by: Benjamin Beckwith <bnbeckwith@gmail.com>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00566.html>
* lisp/org-colview.el (org-columns-summary-types): Allow new format.
(org-columns--summarize): Update to new summary type format.
(org-columns--collect): New function.
(org-columns--compute-spec): Apply changes.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add test.
In addition to (LABEL . SUMMARIZE), org-columns-summary-types now
accepts (LABEL SUMMARIZE COLLECT) entries. The new COLLECT function is
called with one argument, the property being summarized.
TINYCHANGE
* lisp/org-colview.el (org-columns-overlays):
(org-columns-begin-marker):
(org-columns-top-level-marker): Make variables buffer local.
(org-columns-remove-overlays): Assume columns view are to be removed
in current buffer.
(org-columns-edit-allowed): Small refactoring. Raise an error when
called although no columns view is active in current buffer.
(org-columns-goto-top-level):
(org-columns):
(org-agenda-columns): Do not assume `org-columns-begin-marker' and
`org-columns-top-level-marker' are markers.
(org-columns-store-format):
(org-columns-redo): Skip if no columns view is current active.
(org-agenda-colview-compute): Do not let-bind
`org-columns-begin-marker' and `org-columns-top-level-marker'.
* lisp/org-colview.el (org-columns--compute-spec): Make sure current
and new values do not differ only by leading or trailing blanks
before replacing the former by the latter.
Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113597>
* lisp/org-colview.el (org-columns--displayed-value): When value is
a number and a format string is specified, apply it.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add tests.
Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113547>
* contrib/lisp/org-depend.el (org-depend-trigger-todo): Use new
functions.
* contrib/lisp/org-invoice.el (org-invoice-heading-info):
(org-invoice-info-to-table):
(org-invoice-list-to-table): Use new functions.
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler--build-task): Use
new functions.
* lisp/org-agenda.el (org-agenda-show-clocking-issues):
(org-agenda-format-item):
(org-agenda-filter-effort-form): Use new functions.
* lisp/org-clock.el (org-clock-get-clock-string):
(org-clock-modify-effort-estimate):
(org-clock-notify-once-if-expired):
(org-clock-out):
(org-clock-display):
(org-clock-put-overlay):
(org-clocktable-write-default): Use new functions.
* lisp/org-table.el (org-table-sort-lines): Use new functions.
* lisp/org.el (org-properties-postprocess-alist):
(org-refresh-effort-properties):
(org-set-effort):
(org-entry-properties):
(org-property-next-allowed-value): Use new functions.
(org-time-clocksum-format):
(org-time-clocksum-use-fractional):
(org-time-clocksum-use-fractional-format):
(org-time-clocksum-use-effort-durations): Declare as obsolete. Move
to "org-compat.el".
(org-minutes-to-clocksum-string):
(org-hh:mm-string-to-minutes):
(org-duration-string-to-minutes): Declare as obsolete. Move to
"org-compat.el".
(org-hours-to-clocksum-string): Remove function.
* lisp/org-colview.el (org-columns--collect-values): Use new
functions.
(org-columns--duration-re): Remove variable.
(org-columns--time-to-seconds): Rename to...
(org-columns--age-to-minutes): ... this.
(org-columns--format-age): New function.
(org-columns--summary-apply-times):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): Use new functions.
* testing/lisp/test-org-clock.el (test-org-clock-clocktable-contents-at-point):
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Update tests.
* lisp/org-colview.el (org-agenda-colview-summarize): Do not ignore
first agenda line when displaying summaries.
This fixes a regression introduced in
279902ca4d.
Reported-by: Matt Lundin <mdl@imapmail.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/111473>
* lisp/org-colview.el (org-columns--collect-values): Change signature.
(org-agenda-columns): Apply signature change.
When calling `org-agenda-columns' compiled columns format is set
locally to Agenda buffer, but `org-columns--collect-values' is called
from source buffers. Therefore, it uses default format instead of the
compiled one.
Reported-by: Christian Prothmann <ckprothmann@yahoo.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/110748>
* lisp/org-colview.el (org-columns--time-to-seconds): Recognize
a duration even when it contains a H:MM:SS part.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add test.
Reported-by: Björn Döring <bjoern@doering.io>
<http://permalink.gmane.org/gmane.emacs.orgmode/110144>
* lisp/org-colview.el (org-columns-edit-value): Small refactoring. Use
new function.
(org-columns--call): New function.
(org-columns-eval): Remove function.
(org-columns-next-allowed-value): Use new function.
* lisp/org-colview.el (org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): Fix argument name in docstrings.
* lisp/org-colview.el (org-dblock-write:columnview): Fix typo in pcase
so ID are properly recognized in current document.
* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add tests.
* lisp/org-colview.el (org-columns--display-here): Remove unnecessary
`org-columns-spec' property.
(org-columns-update): Use (current-column) to extract column format
specifications.
* lisp/org-colview.el (org-columns-edit-value):
(org-columns-next-allowed-value): Make sure overlays are still in place
when a property altering current headline is modified. Refactor code.
Do not limit allowed values to 10.
* testing/lisp/test-org-colview.el (test-org-colview/columns-next-allowed-value):
New test.
* lisp/org-colview.el (org-columns-new): Change signature to allow both
editing and column creation non-interactively.
(org-columns-edit-attributes): Use new signature.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new):
Update tests.
* lisp/org-colview.el (org-columns-move-right): Do not compute values
swapping columns. Comment about a corner case.
* testing/lisp/test-org-colview.el (test-org-colview/columns-move-left):
(test-org-colview/columns-move-right): New tests.
* lisp/org-colview.el (org-columns-get-format): Do not assume
`org-columns-default-format' contains valid columns format. Look for
COLUMNS keyword if necessary.
(org-columns-quit): Reset `org-columns-current-fmt'.
(org-columns-redo): Provide `org-columns-current-fmt' as the active
format so as to avoid extracting it again.
* testing/lisp/test-org-colview.el (test-org-colview/get-format): New
test.
* lisp/org-colview.el (org-columns-check-computed): Check if current
column contains an operator instead of looking for an `org-computed'
text property.
(org-columns--compute-spec): Do not apply `org-computed' text property.
* lisp/org-colview.el (org-edit-headline): Move from here...
* lisp/org.el (org-edit-headline): ... to here. Also refactor code.
Accept to set headline non-interactively.
* testing/lisp/test-org.el (test-org/edit-headline): New test.
* lisp/org-colview.el (org-columns-store-format): Make sure we're really
at a COLUMNS keyword before replacing it. Also replace only the first
one, not all of them.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new): Add
tests.
* lisp/org-colview.el (org-columns--collect-values):
(org-agenda-colview-summarize): Use column format specification as the
unique identifier for the returned alist.
* lisp/org-colview.el (org-columns--display-here): Store column format
specification in a new overlay property.
(org-columns--set-widths):
(org-columns--display-here): Use column format specification instead of
(org-columns--displayed-value): Since the same property can have
multiple titles, use column specification instead of property as keys.
(org-columns--collect-values): Apply signature change.
(org-columns-update): Handle multiple columns for the same property.
Also apply signature change to `org-columns--displayed-value'.
(org-columns--compute-spec): New function.
(org-columns-compute):
(org-columns-compute-all): Use new function.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
(test-org-colview/columns-update): Add tests.
* doc/org.texi (Column attributes): Document computation with multiple
summary types for a given property.
* lisp/org-colview.el (org-columns--summarize): Throw an error when no
summarize function is associated to a given operator.
(org-columns-compile-format): Do not provide summarize function, which
can be found using the accessor `org-columns--summarize'.
(org-columns-new):
(org-columns-uncompile-format):
(org-columns-compute):
(org-columns-compute-all):
(org-agenda-colview-summarize): Use new compiled format.
* lisp/org-colview.el (org-columns-compile-format): Property is
upper-cased. Title is not, however.
(org-columns--displayed-value):
(org-columns--collect-values):
(org-columns--autowidth-alist):
(org-columns--overlay-text):
(org-columns--display-here):
(org-columns--display-here-title):
(org-columns-next-allowed-value):
(org-columns):
(org-columns-widen):
(org-columns-update):
(org-columns--capture-view):
(org-dblock-write:columnview):
(org-agenda-colview-summarize): Since properties in compiled format are
upper-cased, remove the `upcase' or `assoc-string' dance.
* testing/lisp/test-org-colview.el (test-org-colview/columns-new):
(test-org-colview/columns-update): Add case-sensitivity tests.
`assoc-string' is still necessary in functions where property is
provided by the user, e.g. `org-columns-update'.
* lisp/org-colview.el (org-columns--summarize): New function.
(org-columns-new):
(org-columns-compile-format): Use new function.
(org-agenda-colview-summarize): Use new function. Fix return value for
CLOCKSUM and CLOCKSUM_T.
* lisp/org-colview.el (org-columns-summary-types): New variable.
(org-columns-compile-map): Rename into...
(org-columns-summary-types-default): ... this.
(org-columns-new):
(org-columns-compile-format): Use new variables.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Add test.
* doc/org.texi (Column attributes): Document new variable. Improve
description of time and age based summary types.
* lisp/org-colview.el (org-columns-compile-map): Externalize summary
functions. Remove "none" summary.
(org-columns-new): Apply previous removal.
(org-columns--fractional-duration-re): Rename variable to...
(org-columns--duration-re): ... this.
(org-columns-compute): Change how values are computed. This is now done
in one pass. A summarize function is given a list of strings and
possible a format string. It has to return the computed value as
a string.
(org-columns--time-to-seconds):
(org-columns--age-to-seconds):
(org-columns--summary-apply-times):
(org-columns--summary-sum):
(org-columns--summary-currencies):
(org-columns--summary-checkbox):
(org-columns--summary-checkbox-count):
(org-columns--summary-checkbox-percent):
(org-columns--summary-min):
(org-columns--summary-max):
(org-columns--summary-mean):
(org-columns--summary-sum-times):
(org-columns--summary-min-time):
(org-columns--summary-max-time):
(org-columns--summary-mean-time):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): New functions.
(org-columns--summary-estimate):
(org-agenda-colview-summarize): Update functions to new process.
(org-columns-string-to-number): Apply variable renaming.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
Fix test. Add some more.