Commit Graph

1966 Commits

Author SHA1 Message Date
Ihor Radchenko 5d3173cb04
org-compile-prefix-format: Document argument
* lisp/org-agenda.el (org-compile-prefix-format): Document the KEY
argument in the docstring.

Reported in https://orgmode.org/list/CAJ1MqVGR0w93wYi7r0NNmDJxBKeY8vh2=f307u1JeGBOUC597g@mail.gmail.com
2022-05-03 11:38:10 +08:00
Ihor Radchenko ce58542c85
org-agenda.el: Re-enable native compilation
* lisp/org-agenda.el: Re-enable native compilation as it does not
cause any issues with agenda rendering without other custom changes
not included in this branch.
2022-04-25 19:40:14 +08:00
Ihor Radchenko 67275f4664
Implement link folding
* lisp/ol.el (org-link--link-folding-spec):
(org-link--description-folding-spec): New variables controlling link
folding settings.
(org-link--reveal-maybe): Handle revealing folded links.
(org-link-descriptive-ensure): Implement `org-link-descriptive'
support with org-fold.
(org-toggle-link-display--overlays):
(org-toggle-link-display--text-properties):
(org-toggle-link-display): Provide text-properties and overlays
versions.
* lisp/org-agenda.el (org-agenda-mode): Use org-fold to fold links in
agenda.
* lisp/org.el (org-do-emphasis-faces): Use org-fold.
2022-04-25 19:39:54 +08:00
Ihor Radchenko fa7530c7b4
Rename old function call to use org-fold 2022-04-25 19:39:53 +08:00
Ihor Radchenko bc0caec6eb
org-at-heading-p: Accept optional argument
* lisp/org.el (org-at-heading-p): Use second argument to allow
checking for visible headings.  Note that by default, unlike
`outline-on-heading-p', `org-at-heading-p' returns non-nil for
invisible headings. Passing second argument is just like
`(outline-on-heading-p)'.
(org-indent-line):
* lisp/org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org-colview.el (org-columns--call):
(org-columns-store-format): Update arguments in `org-at-heading-p'
calls.
2022-04-25 19:39:51 +08:00
Ihor Radchenko b415111aff
Disable native-comp in agenda
It caused cryptic bugs in the past.
2022-04-25 19:39:50 +08:00
Ihor Radchenko 81a2fe4f0b
org-agenda: Use `window-max-chars-per-line' to calculate max text width
* lisp/org-agenda.el (org-agenda-prepare):
(org-todo-list):
(org-agenda-align-tags):
(org-agenda-show-new-time): Calculate the maximum number of chars
fitting into window via `window-max-chars-per-line' instead of
`window-with' or `window-text-with'.  The latter functions can return
larger number when fringes are disabled [1].

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19395

Reported in https://orgmode.org/list/87czhdqi9p.fsf_-_@moondust.localdomain
2022-04-24 14:54:49 +08:00
Bastien 1bdacbe729 Merge branch 'bugfix' 2022-03-28 14:26:44 +02:00
Nick Dokos 7caae6c088 Fix typo in doc string
* lisp/org-agenda.el (org-todo-list): Fix typo in doc string.
2022-03-28 14:26:26 +02:00
Ihor Radchenko c9c0b9d004
Merge branch 'bugfix' 2022-03-22 17:40:49 +08:00
Ihor Radchenko d9bf64f064
org-agenda: Match timestamps inside node properties
* lisp/org-agenda.el (org-agenda-get-timestamps): Use
`org-at-timestamp-p' instead of org-element to check if at valid
timestamp.  Agenda should consider timestamps inside node properties
even though they are not parsed by org-element.

* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking active timestamp inside property drawer.

* testing/examples/agenda-file.org (test timestamp inside properties):
Add heading for `test-org-agenda/property-timestamp'.

Reported in https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com
2022-03-22 17:37:47 +08:00
Ihor Radchenko b7c32d873d
Merge branch 'bugfix' 2022-03-21 15:26:37 +08:00
Samim Pezeshki 847e332301
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
2022-03-21 15:25:13 +08:00
Ihor Radchenko 7f6b6e4891
Merge branch 'bugfix' 2022-01-30 16:52:15 +08:00
Ihor Radchenko dd6486a070
Make sure that declarative defvars do not set variable value
* lisp/ob-tangle.el (org-id-link-to-org-use-id):
* lisp/org-agenda.el (org-agenda-overriding-header): Do not try set
value of a variable defined elsewhere.  This may interfere with custom
interface.  See
https://list.orgmode.org/orgmode/871r19ryxb.fsf@localhost/

(org-agenda-restrict):
* lisp/ol-bibtex.el (org-bibtex-description): Remove incorrect
comments.
2022-01-30 16:46:12 +08:00
Ihor Radchenko 589cc0732e
Merge branch 'bugfix' 2022-01-30 15:41:49 +08:00
TEC 1b675f0ca8
org-agenda: Make timestamp ordering match docs
* lisp/org-agenda.el: When `org-agenda-sort-notime-is-late' is non-nil,
an absent timestamp is now (correctly) treated as maximal.

Bug reported by: Charles Tam <me@charlest.net> in
https://list.orgmode.org/CAKu+9YVNPSHG4HVtPFa2L2tP6yBdjJ38Teyr8OSDmCg0ZEOe9Q@mail.gmail.com
2022-01-30 15:40:13 +08:00
Samim Pezeshki 22e6ed6b89 agenda: Add header to agenda clock report table
* lisp/org-agenda.el (org-agenda-list): Add header to agenda clock
report table.

TINYCHANGE
2022-01-26 21:07:49 +01:00
Ihor Radchenko a9b2e262cd
Merge branch 'bugfix' 2022-01-12 21:11:33 +08:00
Ihor Radchenko e8d6db540b
org-agenda-get-timestamps: Ignore non-timestamps matching re
* lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm
that object at point is a timestamp.

Fixes https://list.orgmode.org/20220102210433.GC29829@itccanarias.org/T/#m39b80d45d7d6cfc6b713284365c283579ac94cb1
2022-01-12 21:08:49 +08:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Ihor Radchenko ed392bc1c9
Merge branch 'bugfix' 2021-12-18 16:12:59 +08:00
Ihor Radchenko 85aaa19908
org-agenda: Make sure that time grid is aligned when hour <10
* lisp/org-agenda.el (org-agenda-format-item): Make sure that hour
part of begin time in time grid always occupy 5 chars

Fixes https://list.orgmode.org/orgmode/3afe1bba.2f48.17c350d0a41.Coremail.tumashu@163.com/
2021-12-18 16:07:58 +08:00
Ihor Radchenko 67fb7a4892
org-agenda-get-deadline: Use org-element-cache 2021-12-11 10:08:39 +08:00
Ihor Radchenko 08e595f312
org-agenda-get-scheduled: Fix wrong matches when WITH-HOUR is non-nil
* lisp/org-agenda.el (org-agenda-get-scheduled): Do not rely on regex
match to judge that current headline is scheduled with time when
WITH-HOUR argument is non-nil.  Limit regexp search when looking for
scheduled timestamp in current headline and intentionally signal
search error if something went wrong (headline without scheduled
timestamp in planning line must not be encountered at this point in
the code).

This commit continues 77a9932b0 and 82197761.
2021-11-25 18:39:11 +08:00
Bastien 77a9932b03 lisp/org-agenda.el:
* lisp/org-agenda.el (org-agenda-get-scheduled): Don't throw an
error when the search for the regular expression fails.

This completes 82197761.
2021-11-24 09:02:28 +01:00
Ihor Radchenko cf8906eee0
org-agenda-get-todos: Fix effort-up sorting in todo agenda
* lisp/org-agenda.el (org-agenda-get-todos): Calculate effort-minutes
before adding it as text property in agenda line.

Reported in https://old.reddit.com/r/emacs/comments/qfqcip/sorting_by_effort_doesnt_work_on_latest_org/
2021-10-26 09:47:58 +08:00
Ihor Radchenko a149fdd569
org-agenda-get-scheduled: Fix deadline value when using cache
* lisp/org-agenda.el (org-agenda-get-scheduled): First `deadline'
let-binding when element cache is enabled should not be timestamp
element, but a string.  Make it so.

Reprted in https://list.orgmode.org/87tuhazs36.fsf@localhost/T/#t
2021-10-21 16:50:10 +08:00
Ihor Radchenko 821977611c
org-agenda-get-scheduled: Make sure that 'org-marker is at timestamp
* lisp/org-agenda.el (org-agenda-get-scheduled): Use beginning
position of the timestamp as 'org-marker.

Fixes https://list.orgmode.org/87sfwyrcyj.fsf@gnu.org/T/#meeca619b0abd3c3b30fe5057b51c891e8de705b8
2021-10-18 16:07:40 +08:00
Ihor Radchenko d18beb7c6f
Fix effort calculation in agenda
* lisp/org-agenda.el (org-agenda-get-scheduled): Fix property symbol
in `org-element-property' call.

(org-agenda-get-todos, org-agenda-get-scheduled,
org-agenda-get-timestamps, org-agenda-get-sexps,
org-agenda-get-progress, org-agenda-get-deadlines,
org-agenda-get-blocks, org-agenda-change-all-lines): Pass effort
properties to `org-agenda-format-item'
2021-10-18 13:40:06 +08:00
Ihor Radchenko 7a04f3b1cd
Fix 'org-hd-marker position changed in 0ef88e2d9
* lisp/org-agenda.el (org-agenda-get-scheduled): Move to correct point
before calculating the marker position.
2021-10-17 18:48:33 +08:00
Ihor Radchenko 0ef88e2d91
org-agenda.el/org-agenda-get-scheduled: Use cache
* lisp/org-agenda.el (org-agenda-get-scheduled): Use
`org-element-cache-map' for faster agenda generation.
2021-10-17 18:29:35 +08:00
Ihor Radchenko e70a8aac59
Use org-element-cache in place of text property cache in agenda
* lisp/org-agenda.el (org-agenda-skip): Use
`org-in-archived-heading-p' and `org-in-commented-heading-p' in place
of text property cache.

(org-agenda-get-todos, org-agenda-get-timestamps,
org-agenda-get-sexps, org-agenda-get-progress,
org-agenda-get-deadlines, org-agenda-get-scheduled,
org-agenda-get-blocks): Do not use text property cache in favour of
Org API functions.  The API functions use cache now.

* lisp/org-clock.el (org-element--cache-active-p): Declare function to
suppress compiler warning.

(org-clock-in): Do not use text property cache when element cache is
active.

* lisp/org-duration.el (org-duration-to-minutes): Do not change match
data.  It is needed to not break agenda---agenda relies on match data
not being altered.

* lisp/org.el (org-run-like-in-org-mode): Use element cache.
(org-refresh-category-properties): Use element cache.
(org-make-tags-matcher, org-agenda-prepare-buffers): Do not rely on
text property cache.

* testing/lisp/test-org.el (test-org/refresh-category-properties): Do
not use text property cache.
2021-10-16 23:50:21 +08:00
Kyle Meyer cc2490a706 Prune Emacs 25.1 compatibility kludges
* lisp/oc-basic.el (org-cite-basic--field-less-p):
* lisp/ol-eww.el (org-eww-store-link):
* 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-sum): Drop now unnecessary use of
compatibility functions.

* lisp/org-compat.el (org-string-collate-lessp, org-decode-time)
(org-format-time-string, org-link-escape-browser, org-time-add)
(org-time-subtract, org-time-since, org-time-less-p): Mark as
obsolete.

The 9.5 release declared Emacs 25.1 as the minimum version.
2021-10-04 23:43:14 -04:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Kyle Meyer 1292d89c37 Clean up spacing to pass Emacs's pre-commit check
* lisp/org-agenda.el (org-agenda-highlight-todo):
(org-agenda-set-mode-name):
* lisp/org-table.el (org-table-eval-formula): Avoid space before tab in
indent.

This is in preparation for syncing with the Emacs repo.
2021-09-29 00:37:30 -04:00
Christopher League c305bb7418 org-agenda: Allow org-agenda-overriding-header to be a function
* org-agenda.el (org-agenda--insert-overriding-header): Allow
`org-agenda-overriding-header' to be a function in addition to a
string or nil. When the custom agenda is created or updated, call that
function and insert the string it returns as the agenda header.

This allows custom commands to produce dynamic headers that include
up-to-date information. For example, this produces a header with a
current timestamp:

(push '("DHD" "Dynamic header demo"
        ((alltodo
          ""
          ((org-agenda-overriding-header
            (lambda ()
              (propertize
               (format-time-string "-- Get crackin’, it’s %H:%M:%S!!\n")
               'face 'org-agenda-structure)))))))
      org-agenda-custom-commands)

User is free to add any face properties, use Org links, and include a
blank line or not. I am using this to count how many items are in
various inboxes and display them in an agenda.
2021-09-27 11:59:33 +02:00
Kyle Meyer d9d5594c24 Merge branch 'km/from-emacs-master' 2021-09-26 23:24:13 -04:00
Stefan Kangas 1f3722c6b5 Backport commit c78e16962 from Emacs
; Adjust overly long docstrings to fit 80 characters
c78e16962e63895d340f80cf245fad568a7da770
Stefan Kangas
Sun Sep 26 13:23:57 2021 +0200
2021-09-26 22:49:55 -04:00
Lars Ingebrigtsen 63a5af9e8e Backport commit 85e9e5f61 from Emacs
* lisp/ox-html.el (org-html-htmlize-output-type):
* lisp/org-agenda.el (org-agenda-do-in-region): Don't quote t and nil.

Don't quote nil and t in doc strings and comments
85e9e5f616fb0fd0819a04006d6d2a0fb6d93ad7
Lars Ingebrigtsen
Tue Sep 21 22:11:43 2021 +0200
2021-09-26 22:49:55 -04:00
Lars Ingebrigtsen d9fcd078ff Backport commit 43c1ee90c from Emacs
* lisp/org-agenda.el (org-search-view): Don't use `format' on
strings that have no % format directives in them.

Don't use `format' on strings without % format directives
43c1ee90cb3333dc2643e58cf607399b0abebf43
Lars Ingebrigtsen
Tue Sep 21 17:52:53 2021 +0200
2021-09-26 22:49:54 -04:00
Protesilaos Stavrou 4b7d80cb60 Add faces to improve contextuality of agenda views
* lisp/org-agenda.el (org-search-view)
(org-agenda-propertize-selected-todo-keywords, org-todo-list)
(org-tags-view): Implement new org-agenda-structure-filter and
org-agenda-structure-secondary faces.
(org-agenda-get-day-face): Add condition for rendering the current
date heading in org-agenda-date-weekend-today.

* lisp/org-faces.el (org-agenda-structure-secondary)
(org-agenda-date-weekend-today, org-agenda-structure-filter)
(org-imminent-deadline): Add new faces.
(org-agenda-deadline-faces): Use the 'org-imminent-deadline' for
current deadlines instead of the generic 'org-warning'.
2021-09-26 10:44:14 +02:00
Ihor Radchenko 1c83f6fa02 Allow sexps with nested parenthesis in org-agenda-prefix-format
* lisp/org-agenda.el (org-compile-prefix-format): Use `read' instead
of pure regexp matching to determine bounds of %(sexp) expressions in
`org-agenda-prefix-format'.

Fixes https://orgmode.org/list/87fsy8yi1e.fsf@localhost/
2021-09-26 09:12:14 +02:00
Ihor Radchenko a3c912cb29 Fix duplicate logbook entry for repeated tasks
* lisp/org.el (org-add-log-setup): Always run `org-add-log-note' via
`post-command-hook'.  Otherwise, there is no way to know if a note was
requested for `this-command'.  Running `org-add-log-note' directly
would, for example, break `org-auto-repeat-maybe' as reported in [1].

* lisp/org-agenda.el (org-agenda-todo): Avoid reintroducing the bug
fixed in c670379adf.

* testing/lisp/test-org.el: Add test checking the reported bug.

[1] https://orgmode.org/list/CAOn=hbcaW1R6vtun-E2r4LS=j3dp=VjqmjGtzy8UC1SyPArKbA@mail.gmail.com
2021-09-25 17:23:53 +02:00
Bastien 179ae6b232 Merge branch 'bugfix' 2021-09-25 17:16:49 +02:00
Ihor Radchenko 6a2c48704b Avoid infinite loop in org-agenda-dim-blocked-tasks
* lisp/org-agenda.el (org-agenda-dim-blocked-tasks): When the blocked
task is the last line in agenda buffer and no trailing newline is
present, (move-beginning-of-line 2) would not move the point causing
infinite loop.  Now, such case is handled correctly.
2021-09-25 17:16:38 +02:00
Bastien 26b0297f65 Merge branch 'bugfix' 2021-09-25 15:53:16 +02:00
Maxim Nikulin 3f5605e66c org-agenda.el: Avoid dependency on subr-x
* lisp/org-agenda.el (org-agenda-highlight-todo): Do not use `string-empty-p'.

Restore compatibility with Emacs-24.3.
2021-09-25 15:53:07 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00