Commit Graph

1916 Commits

Author SHA1 Message Date
Marco Wahl b1a74d4c7a agenda: Fix whitespace 2021-08-31 00:07:59 +02:00
Kyle Meyer 926dbafe43 Merge branch 'km/from-emacs-master' 2021-08-08 18:07:20 -04:00
Lars Ingebrigtsen 0f7fcc9de0 Backport commit 6a3920c07 from Emacs
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Using `error' here will trigger users with `debug-on-error' so use
`user-error' instead (bug#49920).  It would probably be preferable
to rewrite this to not use the error system to do control flow.

Make `q' in `org-agenda' work even with `debug-on-error' set
6a3920c07eaae58408dd27e7db22bff7ad4d1f80
Lars Ingebrigtsen
Sat Aug 7 12:55:39 2021 +0200
2021-08-08 18:06:30 -04:00
Nicolas Goaziou 5e4815f816 Merge branch 'maint' 2021-06-20 18:08:35 +02:00
Nicolas Goaziou c09356548f agenda: Fix `org-get-time-of-day' on empty string
* lisp/org-agenda.el (org-get-time-of-day): Ensure S is not empty
before calling `get-text-property'.

This regression was introduced in aba1f2066.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-06/msg00385.html>

Reported-by: Ihor Radchenko <yantar92@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-06/msg00385.html>
2021-06-20 18:07:01 +02:00
Nicolas Goaziou ceb78e0159 Merge branch 'maint' 2021-06-18 14:13:47 +02:00
Nicolas Goaziou 15badb32b7 agenda: Fix org-duration-to-minutes error (take 4)
* lisp/org-agenda.el (org-get-time-of-day): Fix regexp.

This is a followup to aba1f20661.
2021-06-18 14:12:08 +02:00
Nicolas Goaziou 5a03ad86cd Merge branch 'maint' 2021-06-17 19:27:26 +02:00
Nicolas Goaziou aba1f20661 agenda: Fix org-duration-to-minutes error (take 3)
* lisp/org-agenda.el (org-agenda-format-item): Call
`org-get-time-of-day' twice. Once to get proper time information, and
a second time to format it.
(org-get-time-of-day): Remove an optional argument.  Extend the one
left, and document it.  Rewrite function.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<https://orgmode.org/list/87lf84408r.fsf@ucl.ac.uk/>
2021-06-17 19:23:36 +02:00
Bastien e80a0094bb Merge branch 'maint' 2021-05-17 07:20:32 +02:00
Bastien a34d71560b Revert "lisp/org-agenda.el: Let tags-todo searches include DONE keywords"
This reverts commit 823f9744e9.
2021-05-17 07:18:35 +02:00
Bastien 59c6e24606 Merge branch 'maint' 2021-05-17 00:54:23 +02:00
Bastien 823f9744e9 lisp/org-agenda.el: Let tags-todo searches include DONE keywords
* lisp/org-agenda.el (org-agenda, org-agenda-run-series): Don't
set the todo-only parameter to '(4) when calling `org-tags-view'.

Reported-by: Stig Brautaset <stig@brautaset.org>
Link: https://orgmode.org/list/m2ftazm3l1.fsf@brautaset.org/

This completes 2fb129b5c, as per Kyle's analysis here:
https://orgmode.org/list/87r1ufmw72.fsf@kyleam.com/
2021-05-17 00:49:32 +02:00
Bastien 59edcc27c4 Merge branch 'maint' 2021-05-17 00:17:06 +02:00
Bastien c670379adf Fix `org-agenda-todo' undo behavior when logging (not adding note)
* lisp/org.el (org-log-setup): New variable.
(org-auto-repeat-maybe): Check against `org-log-setup' if we are
currently logging.
(org-add-log-setup): Only use `post-command-hook' when logging a
note, otherwise use `org-log-setup'.
(org-add-log-note): Reset `org-log-setup' to nil.
(org-store-log-note): Remove useless code.

* lisp/org-agenda.el (org-agenda-bulk-action): Check
`org-log-setup' instead of `post-command-hook'.

This is a more correct fix that supersedes the previous attempt with
08a47b09 for the same problem.

Reported-by: Warren Lynn <wrn.lynn@gmail.com>
Link: https://orgmode.org/list/87v98a8mes.fsf@gnu.org/
2021-05-17 00:14:31 +02:00
Bastien 336efd6dd9 lisp/*: Use version number when obsoleting
* lisp/org-compat.el:
* lisp/org-agenda.el:
* lisp/org-macs.el:
* lisp/org.el:
* lisp/ob-sqlite.el: Use version number when obsoleting.
2021-05-16 09:54:28 +02:00
Bastien c7be27d505 Merge remote-tracking branch 'savannah/bugfix' 2021-05-15 16:25:09 +02:00
mosquito-magnet 307e722dd9 org-agenda.el: Fix clocking issues regex
* org-agenda.el (org-agenda-show-clocking-issues): Fix regex
to prevent false-positive clocking issue detection.

Regex was missing a grouping to restrict the alternative \| to the
literal parentheses.

TINYCHANGE
2021-05-15 16:18:58 +02:00
Bastien 81c7a2dee8 lisp/org-agenda.el: Use "09:00" instead of " 9:00"
* lisp/org-agenda.el (org-get-time-of-day): Use "09:00" instead
of " 9:00" when displaying as a string.

This makes the string more readable, especially for users reading
the agenda with a screen reader.

Reported-by: Sébastien Hinderer
2021-05-15 16:13:49 +02:00
Bastien c6d11502e0 Fix code typo in 06c064e9 (take 2) 2021-05-15 16:13:49 +02:00
Bastien e53572e130 Fix code typo in 06c064e9 2021-05-15 16:13:49 +02:00
Samim Pezeshki 90a9ee1741 lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'
* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
2021-05-15 16:13:49 +02:00
Bastien ed5e28939b Fix code typo in 06c064e9 (take 2) 2021-05-15 14:26:56 +02:00
Bastien 77213acb8f Fix code typo in 06c064e9 2021-05-15 14:17:38 +02:00
Samim Pezeshki 06c064e97c lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'
* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
2021-05-15 10:11:36 +02:00
Nicolas Goaziou dcb6013fb6 agenda: Fix org-duration-to-minutes error (take 2)
* lisp/org.el (org-stamp-time-of-day-regexp): Limit match group 2 to
first time.
* lisp/org-agenda.el (org-agenda-format-item): Compute duration before
formatting time with `org-get-time-of-day'.
2021-05-12 06:37:54 +02:00
Nicolas Goaziou c26f8d2cc5 agenda: Fix org-duration-to-minutes error (take 2)
* lisp/org.el (org-stamp-time-of-day-regexp): Limit match group 2 to
first time.
* lisp/org-agenda.el (org-agenda-format-item): Compute duration before
formatting time with `org-get-time-of-day'.
2021-05-11 09:39:08 +02:00
Nicolas Goaziou 9a7207404c Merge branch 'maint' 2021-05-10 18:02:32 +02:00
Nicolas Goaziou 6107c2b15b Revert "agenda: Fix "org-duration-to-minutes: Invalid duration format" error"
This reverts commit bc857bfc62.

The "fix" breaks elsewhere, as reported below.

Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00592.html>
2021-05-10 18:00:58 +02:00
Nicolas Goaziou 6f1ea80bbd Merge branch 'maint' 2021-05-09 21:51:17 +02:00
Nicolas Goaziou bc857bfc62 agenda: Fix "org-duration-to-minutes: Invalid duration format" error
* lisp/org-agenda.el (org-agenda-format-item): Compute duration with
`org-duration-to-minutes' before normalizing input.

Reported-by: Stephen Eglen <sje30@cam.ac.uk>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00584.html>
2021-05-09 21:49:23 +02:00
Bastien 0f2ece647b Update Carsten's email address in some files 2021-05-07 16:50:57 +02:00
Bastien edc2e68e85 Merge branch 'maint' 2021-05-04 00:22:45 +02:00
Bastien eecc0574d8 lisp/org-agenda.el: Prevent wrong scrolling
* lisp/org-agenda.el (org-agenda-later): Prevent window from
scrolling to the point when `scroll-conservatively' is > 101.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87lfh2hk4k.fsf@gmail.com/
2021-05-04 00:22:33 +02:00
Bastien dfc0d522f1 Revert "lisp/org-agenda.el: Prevent wrong scrolling"
This reverts commit eca93742b6.
2021-05-04 00:20:07 +02:00
Bastien 01d3e671b4 Merge branch 'maint' 2021-05-03 22:28:47 +02:00
Bastien eca93742b6 lisp/org-agenda.el: Prevent wrong scrolling
* lisp/org-agenda.el (org-agenda-later): Prevent window from
scrolling to the point when `scroll-conservatively' is > 101.

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/87lfh2hk4k.fsf@gmail.com/
2021-05-03 22:27:48 +02:00
Kyle Meyer 2d965df01a Merge branch 'maint' 2021-05-01 15:49:24 -04:00
Kyle Meyer 94837fc6b5 agenda: Fix org-agenda-show-new-time on Emacs 24
* lisp/org-agenda.el (org-agenda-show-new-time): Add fallback for when
window-font-width isn't available.

efbf96389 (org-agenda.el: Fix display of agenda new time, 2020-02-02)
reworked the column calculation to use window-font-width, but that
function isn't available until Emacs 25, and it's definition can't be
easily ported to org-compat.

Instead just use the old logic, which had been in place since v8.2.6,
when window-font-width isn't available.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
Link: https://orgmode.org/list/87y2d2mqik.fsf@localhost
2021-05-01 15:48:11 -04:00
Bastien Guerry e080eb759a lisp/org-agenda.el: Small refactoring and docstring enhancement
* lisp/org-agenda.el (org-agenda-priority): Small refactoring
and docstring enhancement.

Link: https://orgmode.org/list/87o8j3360f.fsf@kyleam.com/
2021-05-01 12:41:46 +02:00
Bastien Guerry 84d6c31069 Merge branch 'maint' 2021-05-01 08:35:01 +02:00
Bastien Guerry d18071b4ff lisp/org-agenda.el: Make tags filtering case-sensitive
* lisp/org-agenda.el (org-agenda-filter)
(org-agenda-get-represented-tags)
(org-agenda-filter-make-matcher-tag-exp): Make tags filtering
case-sensitive.

This fixes a bug introduced in commit 13a1a4fb9.
2021-05-01 08:33:20 +02:00
Bastien Guerry 31d48755bf Merge branch 'maint' 2021-04-27 09:43:11 +02:00
Bastien Guerry 13a1a4fb96 Be more consistent about treating tags as case-sensitive
* lisp/org-agenda.el (org-agenda-finalize):
(org-agenda-format-item): Do not downcase tags.
(org-downcase-keep-props): Remove unused function.
(org-agenda-filter-expand-tags): Do not case-fold search.

* lisp/org.el (org-tags-expand): Document `downcased' argument as
obsolete and do not allow to expand downcased tags.

* testing/lisp/test-org.el (test-org/tags-expand): Remove test for
downcased tags expansion.

* doc/org-manual.org (TODO keywords, tags, properties, etc.):
Suggest that user-defined are usually lowercase, but don't make it
a requirement.

Reported-by: David Masterson <dsmasterson92630@outlook.com>
Link: https://orgmode.org/list/SJ0PR03MB5455D8D0C4F71AA495A9ABF79B709@SJ0PR03MB5455.namprd03.prod.outlook.com/
2021-04-27 09:41:26 +02:00
Ihor Radchenko 0260d2fcf6 Allow multiple %(expression) instances in org-agenda-prefix-format
* lisp/org-agenda.el (org-compile-prefix-format): Use non-greedy match
for %(expression).

Previously, format like "%-12.12s%(expr1) %(expr2)" would not be
parsed correctly because of greedy "(.+)" regexp used to match the
expressions.
2021-04-26 10:06:18 +02:00
Stefan Kangas 3a7e1c047e Remove diary-list-entries Emacs 21 compat code
* lisp/org-agenda.el (org-get-entries-from-diary): Remove some
Emacs 21 compat code; 'list-diary-entries' was made obsolete in
favour of 'diary-list-entries' in 22.1 and removed in 24.1.
2021-04-17 15:18:04 -04:00
Renato Ferreira 6a50e41ea5 org-agenda.el: Rename org-agenda-format-item parameters
* org-agenda.el (org-agenda-format-item): Rename parameters so they
don't clash with dynamic variables used by
`org-prefix-format-compiled'.

TINYCHANGE
2021-03-29 23:09:38 -04:00
Stefan Monnier 129c33dddf * lisp/org-agenda.el: Use lexical-binding
- Removed the global (defvar date) and (defvar entry) so as not to
  conflict with function arguments of that name.  Instead I added such
  `defvar`s in the body of each of the functions where it
  seemed needed.
- I added some FIXMEs for some issues I found along the way.
- Added an `org-dlet` macro, just like I had done for `calendar-dlet`,
  but I also use `defvar` "manually" at some places, when splitting an
  existing `let` into a mix of `let`s and `dlet`s seemed too much trouble.
- Removed uses of `org-let and `org-let2` not only because I consider
  them offensive to my sense of aesthetics but also because they're
  basically incompatible with lexical scoping.
  I replaced them with uses of `cl-progv` which are a bit more verbose.
  Maybe we should define some `org-progv` macro on top of `cl-progv` to
  make the code less verbose, but I didn't do that because I like the
  fact that the current code makes uses of `eval` a bit more obvious
  (since these behave differently with lexical scoping than with
  lexical binding, it seemed worthwhile).
- Removed the use of `eval` in `org-store-agenda-views` which was only
  placed there in order to use a macro before it's defined (it would
  have been simpler/cleaner to just move that functions *after* the
  macro, but with the new code the problem doesn't occur any more anyway).
- Replaced a few `(lambda...) with actual closures.

Detailed changes follow:

(date, entry): Don't declare as being globally dynbound.
(org-agenda-format-date-aligned): Remove unused var `weekyear`.
(org-agenda-mode): `run-mode-hooks` is always available nowadays.
(org-agenda-undo): Remove unused var `last-undo-buffer`.
(org-agenda): Rename arg to `keys` and then dyn-bind it as `org-keys`.
Remove unused vars `buf` and `key`.
(org-agenda): Use `pcase` and `cl-progv` instead of `org-let`.
(org-let, org-let2): Mark as obsolete.
(org-agenda-run-series): Use `cl-progv` instead of `org-let` and `org-let2`.
(org-agenda-run-series): New function.
(org--batch-agenda): New function extracted from `org-batch-agenda`.
(org-batch-agenda): Use it.
(org--batch-agenda-csv): New function extracted from `org-batch-agenda-csv`.
(org-batch-agenda-csv): Use it.
(org--batch-store-agenda-views): New function, extracted from
`org-batch-store-agenda-views`.
(org-store-agenda-views, org-batch-store-agenda-views): Use it.
(org--batch-store-agenda-views): Use `cl-progv` instead of
`org-eval-in-environment`.
(org-agenda-write): Use `cl-progv` instead of `org-let`.
Use `with-current-buffer`.
(org-agenda-filter-any): Use `cl-some` instead of `eval`.
(org-agenda-list): Remove unused var `e`.
(org-search-view): η-reduce.
(crm-separator): Declare var.
(org-agenda-skip-if): Remove unused var `beg`.
(org-agenda-list-stuck-projects): Use a closure rather than `(lambda..).
(diary-modify-entry-list-string-function, diary-file-name-prefix)
(diary-display-function): Declare vars.
(org-diary): Declare `date` and `entry` as dynbound.
(org-agenda-get-day-entries): Use `org-dlet`.
(org-agenda-get-timestamps, org-agenda-get-progress)
(org-agenda-get-deadlines, org-agenda-get-scheduled, org-agenda-get-blocks):
Declare `date` as dynbound.
(org-agenda-get-sexps, org-class): Declare `date` and `entry` as dynbound.
(org-agenda-format-item): Declare the vars mentioned in
`org-compile-prefix-format` as dyn-bound.
Also binding `extra`, suggested by Kyle Meyer <kyle@kyleam.com>.
(org-compile-prefix-format): Remove unused var `e`.
Use `member` rather than or+equal.
(org-set-sorting-strategy): Minor simplification.
(org-entries-lessp): Use `org-dlet`.
(org-agenda-redo): Declare var `org-agenda-tag-filter-while-redo`.
(org-agenda-redo): Use `cl-progv` rather than `org-let`.
(org-agenda-filter): Remove unused var `rpl-fn`.
Use `org-pushnew-to-end` to replace `add-to-list` on lexical var.
(org-agenda-filter-by-tag): Remove unused var `n`.
(org-agenda-filter-apply): Use `org-dlet`.
(org-agenda-compute-starting-span): Remove unused var `dg`.
(org-agenda-forward-block): Remove unused var `pos`.
(org-archive-from-agenda): Declare var.
(org-agenda-refile): Remove unused var `pos`.
(org-agenda-headline-snapshot-before-repeat): Declare var.
(org-agenda-todo): Remove redundant use of `bound-and-true-p`.
(org-agenda-add-note): Remove unused var `hdmarker` and unused `arg`.
(org-agenda-change-all-lines): Remove unused var `pl`.
(org-agenda-priority): Remove unused var `marker`.
(org-agenda-set-effort): Remove unused var `newhead`.
(org-agenda-schedule): Remove unused var `type`.
(org-agenda-clock-cancel): Remove unused `arg`.
(org-agenda-execute-calendar-command): Use `org-dlet`.
(org-agenda-bulk-action): Use closures instead of `(lambda ...).
(org-agenda-show-the-flagging-note): Remove unused vars `heading` and
`newhead`.
(org-agenda-remove-flag): Avoid `setq`.

* testing/org-test.el (org--compile-when): New macro.
(org-test-jump): Use it so compilation doesn't fail or generate broken
code when `jump` is not available.

* testing/lisp/test-org-src.el:
* testing/lisp/test-org-attach.el:
* testing/lisp/test-org-agenda.el:
* testing/lisp/test-ob-java.el: Pass explicit filename to `require`
so as not to rely on ".../testing" being in `load-path` during compilation.

* lisp/org-num.el: Require` org`.

* lisp/org-macs.el (org-eval-in-environment): Declare obsolete.
(org-dlet, org-pushnew-to-end): New macros.

* doc/Makefile (org.texi, orgguide.texi, %_letter.tex): Simplify quoting.

* contrib/lisp/ob-sclang.el: Don't crash compilation when `sclang`
is not available.

* contrib/lisp/ob-clojure-literate.el: Don't crash compilation when `cider`
is not available.

* contrib/lisp/ob-arduino.el: Don't crash compilation when `arduino-mode`
is not available.

* .gitignore: Add files generated during `make packages/org`.
2021-03-09 22:56:33 -05:00
Kyle Meyer 8b9d6f67a0 Merge branch 'km/from-emacs-master' 2021-02-28 17:24:54 -05:00
Stefan Monnier 63da3ccfb4 Backport commit 8d5dfafab from Emacs
While at it, I enabled lexical-binding in the affected files.

* lisp/org-agenda.el (org-let, org-let2): Move from org-macs and
use `declare`.

* lisp/org-macs.el (org-let, org-let2): Move these functions that are
inherently harmful to your karma to the only package that uses them.
(org-scroll): Use `pcase` to avoid `eval` and use more readable syntax
for those integers standing for events.

* lisp/org-element.el (org-element-map): Use `declare`.

Prefer `declare` over a `put` of `list-indent-function`.
8d5dfafab7dc40d4b74dc0b56d1b314fd8cac390
Stefan Monnier
Mon Feb 22 11:54:17 2021 -0500
2021-02-28 17:24:24 -05:00