emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Appointments duration and effort sums in agenda column view [9.3.7 (release_9.3.7-700-ga1e5be @ ~/.emacs.d/straight/build/org/)]
@ 2020-08-03 19:25 Stanislav Vlasov
  2020-09-07  5:12 ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Stanislav Vlasov @ 2020-08-03 19:25 UTC (permalink / raw)
  To: emacs-orgmode

Dear org community,

It seems that adding appointment duration to efforts sum is not working for Agenda Column View. Setting `agenda-columns-add-appointments-to-effort-sum' does not affect that.

Looking at the org-colview.el code I think that the reason why column view in org agenda can not add entry duration to efforts (even when org-agenda-columns-add-appointments-to-effort-sum is set to t) is because the function org-columns--collect-values which is called on each org entry by org-agenda-columns cannot actually get the text property 'duration at the point where it tries to do that.

I proposed a temporary workaround as an answer to the related question at  Emacs StackExchange - https://emacs.stackexchange.com/questions/58875/how-do-i-add-appointments-to-effort-sum

Kind regards,
Stas

------------------------------------------------------------------------

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2020-05-19
Package: Org mode version 9.3.7 (release_9.3.7-700-ga1e5be @ ~/.emacs.d/straight/build/org/)


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Bug: Appointments duration and effort sums in agenda column view [9.3.7 (release_9.3.7-700-ga1e5be @ ~/.emacs.d/straight/build/org/)]
@ 2022-07-18 14:41 Mamoru Miura
  2022-07-19 14:02 ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Mamoru Miura @ 2022-07-18 14:41 UTC (permalink / raw)
  To: bzg; +Cc: emacs-orgmode, s.vlasov

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Dear org community,

I have also faced the problem and have made a patch to fix it. This patch would
not be the best solution since I'm unfamiliar with Emacs Lisp and the detailed
implementation of org-mode. I'd appreciate that if you would review and merge
the patch attached to this mail.

Kind regards,
Mamoru

[-- Attachment #2: 0001-lisp-org-colview.el-Fix-missing-addition-of-appointm.patch --]
[-- Type: application/octet-stream, Size: 1477 bytes --]

From 314877d3e4ec994a025f267a12ebc4d16b5a2aa5 Mon Sep 17 00:00:00 2001
From: Mamoru Miura <mamo3gr@gmail.com>
Date: Mon, 18 Jul 2022 18:52:40 +0900
Subject: [PATCH] lisp/org-colview.el: Fix missing addition of appointments to
 effort

* lisp/org-colview.el (org-columns--collect-values): re-compute
appointments' duration because this funtion can not get text property
`'duration'.

TINYCHANGE
---
 lisp/org-colview.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 13643101b..35acc9deb 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -288,10 +288,9 @@ possible to override it with optional argument COMPILED-FMT."
 			     ;; to use appointment duration.
 			     org-agenda-columns-add-appointments-to-effort-sum
 			     (string= p (upcase org-effort-property))
-			     (get-text-property (point) 'duration)
-			     (propertize (org-duration-from-minutes
-					  (get-text-property (point) 'duration))
-					 'face 'org-warning))
+			     (when-let* ((formatted-item (org-agenda-format-item nil (org-get-entry) nil nil nil t))
+			                 (duration-string (get-text-property 0 'duration formatted-item)))
+			       (propertize (org-duration-from-minutes duration-string 'face 'org-warning)))
 			"")))
 	    ;; A non-nil COMPILED-FMT means we're calling from Org
 	    ;; Agenda mode, where we do not want leading stars for
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-07-27  8:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-03 19:25 Bug: Appointments duration and effort sums in agenda column view [9.3.7 (release_9.3.7-700-ga1e5be @ ~/.emacs.d/straight/build/org/)] Stanislav Vlasov
2020-09-07  5:12 ` Bastien
2021-05-16 23:11   ` Bastien
2022-07-18 15:27     ` Mamoru Miura
  -- strict thread matches above, loose matches on Subject: below --
2022-07-18 14:41 Mamoru Miura
2022-07-19 14:02 ` Ihor Radchenko
2022-07-19 23:17   ` Mamoru Miura
2022-07-21 11:48     ` Ihor Radchenko
2022-07-27  0:49       ` Mamoru Miura
2022-07-27  4:06         ` Ihor Radchenko
2022-07-27  8:12           ` Mamoru Miura

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).