Commit Graph

488 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
Nicolas Goaziou 0ff705fac7 org-colview: Fix out of range error when hscroll is greater than header
* lisp/org-colview.el (org-columns-hscroll-title): Fix out of range
  error when hscroll is greater than header.
2019-03-21 22:15:04 +01:00
Nicolas Goaziou d437c1b5de Move obsolete function alias into "org-compat.el" 2019-02-25 13:46:41 +01:00
Allen Li cc020dbe4d Fix buffer local org-agenda-overriding-columns-format bug
* doc/org-manual.org (Using Column View in the Agenda): Updated
  reference to variable.
* lisp/org-agenda.el (org-agenda-finalize): Set buffer local variable
  instead.
* lisp/org-colview.el (org-overriding-columns-format): Renamed.
(org-agenda-overriding-columns-format): Renamed.
(org-local-columns-format): New buffer local variable.
(org-columns-edit-value): Updated reference to variable.
(org-columns-next-allowed-value): Updated reference to variable.
(org-agenda-columns): Updated reference to variable.

Setting org-agenda-overriding-columns-format as a buffer local value
interferes with how it is used as a dynamically scoped var, so use a
separate variable for buffer local setting.
2019-02-25 13:41:40 +01:00
Kyle Meyer 6a5be09c1d Restore some current-time to nil changes
* 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.
2019-02-12 19:46:03 -05:00
Kyle Meyer 6df3e8880e Partially revert backport of c75f505de
* 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.
2019-01-13 12:43:04 -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
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou 2d9b08b897 org-colview: Remove asterisks from ITEM in Agenda mode
* 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>
2018-12-18 12:07:43 +01:00
Nicolas Goaziou 4f0d8a008f org-colview: Improve docstring
* lisp/org-colview.el (org-dblock-write:columnview): Improve docstring.
2018-12-18 11:08:48 +01:00
Nicolas Goaziou 13f299fe8b org-colview: Fix docstrings
* lisp/org-colview.el (org-columns--overlay-text):
(org-columns--summary-min-age):
(org-columns--summary-max-age):
(org-columns--summary-mean-age): Fix docstrings.
2018-12-18 09:54:24 +01:00
Nicolas Goaziou 445dc6af6f org-colview: Do not move point when initializing columns
* lisp/org-colview.el (org-columns): Do not move point.

Reported-by: Benjamin Motz <benni.motz@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-07/msg00040.html>
2018-07-07 09:27:04 +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 9d8aade7ec Mark `org-with-silent-modifications' as obsolete
* lisp/org-clock.el (org-clock-sum):
* lisp/org-colview.el (org-columns--display-here):
(org-columns-remove-overlays):
(org-columns-quit):
(org-columns-edit-value):
(org-columns--compute-spec):
(org-columns-compute-all):
(org-agenda-colview-compute):
* lisp/org-indent.el (org-indent-remove-properties):
(org-indent-add-properties):
* lisp/org.el (org-sort-entries):
(org-refresh-properties):
(org-refresh-category-properties):
(org-refresh-stats-properties):
(org-agenda-prepare-buffers): Do not use
`org-with-silent-modifications'.
2018-04-29 12:02:01 +02:00
Nicolas Goaziou eab65c9cf8 Fix colview-related failing tests
* lisp/org-compat.el (org-line-number-display-width): New function.
* lisp/org-colview.el (org-columns--display-here-title): Use new
  function.
2018-04-28 02:17:44 +02:00
Bastien 8cdefed80b org-colview.el: Possibly take linum-offset into account
* lisp/org-colview.el (org-columns--display-here-title):
Possibly take linum-offset into account.

Thanks to Eric S Fraga for reporting this.
2018-04-27 00:44:55 +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
Nicolas Goaziou da26490208 org-colview: Fix typo in docstring
* lisp/org-colview.el (org-columns-summary-types): Fix typo.
2018-02-10 14:03:59 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00
Bastien 8983ac917b org-colview: Allow to filter by tags/property when capturing colview
* 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.
2017-12-29 18:18:14 +01:00
Nicolas Goaziou 259656a76e Merge branch 'maint' 2017-12-03 09:03:37 +01:00
Nicolas Goaziou 2faaacfeeb Revert the whole time zone mess
* lisp/org.el (org-time-string-to-time):
(org-time-string-to-seconds): Remove optional ZONE argument.
(org-2ft):
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-parse-time-string):
* lisp/org-clock.el (org-clock-get-sum-start):
(org-clock-out):
(org-clock-timestamps-change):
(org-clock-sum):
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-columns--age-to-minutes): Apply change.
* testing/lisp/test-org-clock.el (org-test-clock-create-clock):
(test-org-clock/clocktable/scope):
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Apply change.  Simplify tests to avoid daylight saving time issue.
2017-12-03 08:57:37 +01:00
Nicolas Goaziou fbf47cde94 Merge branch 'maint' 2017-09-26 20:05:07 +02:00
Nicolas Goaziou 226d2fcaa2 org-colview: Fix "wrong-type-argument markerp nil"
* 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>
2017-09-26 20:03:03 +02:00
Kyle Meyer 297acd7517 Merge branch 'maint' 2017-09-17 01:17:10 -04:00
Paul Eggert ff0dcf52a5 Backport commit bc511a64f from Emacs
Prefer HTTPS to FTP and HTTP in documentation
bc511a64f6da9ab51acc7c8865e80c4a4cb655c2
Paul Eggert
Wed Sep 13 15:54:37 2017 -0700
2017-09-17 00:28:38 -04:00
Nicolas Goaziou 7b1fabbf88 org-colview: Fix defcustom type
* lisp/org-colview.el (org-columns-summary-types): Fix defcustom type.
2017-09-10 11:16:40 +02:00
Stig Brautaset 2b2314d46d org-colview: Allow custom COLLECT functions for derived properties
* 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
2017-09-10 11:06:43 +02:00
Nicolas Goaziou 23a2fde6fe Remove visual effect of width cookies in tables
* lisp/org-colview.el (org-dblock-write:columnview): Remove :width
  parameter.

* lisp/org-table.el (org-narrow-column-arrow): Remove variable.
(org-table-cleanup-narrow-column-properties): Remove function.
(org-table-align): Ignore width cookies when aligning table.
(org-table-justify-field-maybe):
(org-table-finish-edit-field):
(org-table-follow-fields-with-editor):
(orgtbl-setup): Remove reference to `org-cwidth' property.

* lisp/org.el (org-mode):
(org-hide-wide-columns): Remove function.
(org-set-font-lock-defaults): Apply previous removal.
(org-shorten-string): Ignore `org-cwidth' property.

* testing/lisp/test-org-colview.el (test-org-colview/dblock): Remove
  a test.

Export back-ends may still use width cookie to alter table's output.
2017-09-06 15:18:37 +02:00
Nicolas Goaziou 0623c1c753 org-colview: Allow simultaneous columns views
* 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'.
2017-07-25 09:54:06 +02:00
Nicolas Goaziou 1c7cf61bd7 Merge branch 'maint' 2017-06-14 11:03:40 +02:00
Nicolas Goaziou b47920ed20 org-colview: Fix failing test
* lisp/org.el (org-parse-time-string): Allow to specify zone as an
  optional argument.
* lisp/org-colview.el (org-columns--age-to-seconds): Apply change
  above.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Update tests.
2017-06-14 11:00:01 +02:00
Nicolas Goaziou 496b2a9855 Merge branch 'maint' 2017-05-30 13:39:46 +02:00
Nicolas Goaziou 444d2673bb org-colview: Fix `org-columns' with a prefix argument
* lisp/org-colview.el (org-columns): Fix `org-columns' with a prefix
  argument.
* testing/lisp/test-org-colview.el (test-org-colview/columns-scope):
  Update test.

Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113721>
2017-05-30 13:38:54 +02:00
Nicolas Goaziou 2960dc971b Merge branch 'maint' 2017-05-25 20:56:52 +02:00
Nicolas Goaziou 89bd7ad871 org-colview: Silence byte-compiler
* lisp/org-colview.el (org-columns--displayed-value): Silence
  byte-compiler.
2017-05-25 20:54:39 +02:00
Nicolas Goaziou 61eb86e06c Merge branch 'maint' 2017-05-22 15:28:48 +02:00
Nicolas Goaziou 7f0391cfe0 org-colview: Remove error upon summarizing non-numbers with a format string
* lisp/org-colview.el (org-columns--displayed-value): Remove check.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Remove a test.

Reported-by: Hendrik Tews <hendrik@askra.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113600>
2017-05-22 15:27:17 +02:00
Nicolas Goaziou 78a8078d64 Merge branch 'maint' 2017-05-22 14:18:41 +02:00
Nicolas Goaziou 9fd562f35a org-colview: Update new summarized value only when necessary
* 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>
2017-05-22 14:17:01 +02:00
Nicolas Goaziou 8b79f8c91b Merge branch 'maint' 2017-05-21 11:09:02 +02:00
Nicolas Goaziou 39b3f45a7d org-colview: Fix {X%} and {X/} on recursive summaries
* lisp/org-colview.el (org-columns--summary-checkbox-count):
(org-columns--summary-checkbox-percent): Handle own output for higher
level summaries.
* testing/lisp/test-org-colview.el (test-org-colview/columns-summary):
  Add tests.
2017-05-21 11:08:11 +02:00
Nicolas Goaziou fbc5375118 Merge branch 'maint' 2017-05-21 00:07:56 +02:00
Nicolas Goaziou 3e3e4e621b org-colview: Fix estimate's summary
* lisp/org-colview.el (org-columns--summary-estimate): Per last
  commit, do not make use of printf, since values are not numbers.
2017-05-21 00:06:31 +02:00
Nicolas Goaziou d71e708fe3 Merge branch 'maint' 2017-05-20 22:13:12 +02:00
Nicolas Goaziou ec5df01bd8 org-colview: Properly apply operator format strings on leaf nodes
* 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>
2017-05-20 22:11:45 +02:00
Nicolas Goaziou 52a327e4e5 Merge branch 'maint' 2017-04-28 00:24:46 +02:00