Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]

2024-06-17 Thread Raffael Stocker
Ihor Radchenko  writes:

> May you please convert the diff into a proper patch, so that I can
> install it under your name?

I gave it a try, please see the attachment.

Cheers,
Raffael

>From a94c25606164678b7887e9cc45c059b025f5140c Mon Sep 17 00:00:00 2001
From: Raffael Stocker 
Date: Mon, 17 Jun 2024 21:09:45 +0200
Subject: [PATCH] lisp/org-colview.el: Prevent repeated indentation of keyword
 lines

* org-colview.el (org-columns-dblock-write-default): left trim keyword
and TBLFM lines to prevent repeated indentation.
---
 lisp/org-colview.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	(insert (pop content-lines) "\n")))
+	(insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	(dolist (line content-lines)
 	  (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)
-- 
2.45.2



[BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]

2024-06-17 Thread Raffael Stocker

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hello fellow org-modists,

in columnview dblocks, attribute and tblfm lines wander to the right
instead of staying in place when the table is re-evaluated (see the
example file in the appendix).  This could be cured with a couple of
‘string-trim-left’ applications in ‘org-columns-dblock-write-default’
like so:

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	(insert (pop content-lines) "\n")))
+	(insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	(dolist (line content-lines)
 	  (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)

Regards,
Raffael

Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
Package: Org mode version 9.7.4 (9.7.4-1387e3 @ 
/home/rst/.emacs.d/elpa/org-9.7.4/)


* Overview

  The ~ATTR_LATEX~ and ~TBLFM~ lines will wander to the right with every ‘C-c C-c’
  on the columnview.

  #+BEGIN: columnview :hlines 1 :id "tasks"
  #+ATTR_LATEX: :width \textwidth
  | <40>  |  |   |   |
  | Task  | Estimated Effort | Actual Effort |   |
  |---+--+---+---|
  | Tasks |20:00 |   | 20.00 |
  | Foo   | 8:00 |   |  8.00 |
  | Bar   |12:00 |   | 12.00 |
  #+TBLFM: $4=$2;t
  #+END:

  
* Tasks
  :PROPERTIES:
  :ID: tasks
  :END:
  
** TODO Foo
   :PROPERTIES:
   :Effort:   8:00
   :END:
  
** TODO Bar
   :PROPERTIES:
   :Effort:   12:00
   :END:




[BUG] Incorrect time calculation in agenda clockcheck

2024-05-15 Thread Raffael Stocker

Hi org-mode,

in the Org Agenda clockcheck view, a warning about missing end time of a
clocked-in task is displayed together with the already elapsed time of
that task.  If the starting time is in the future (this can happen if
rounding and continuous clocking are used), the elapsed time is
incorrect.  For example, if a clocked-in task starts in 5 minutes,
clockcheck will report something like "No end time: (0:55)".  It would
be more sensible to say "No end time: (-0:05)" or even "No end time: (in
0:05)".

The culprit is the use of ‘org-duration-from-minutes’ in
‘org-agenda-show-clocking-issues’, because org-duration always assumes
positive durations and is given a negative one here.  The problem can
easily be corrected with something like the following:

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index b3c7294a2..968b6bd50 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6237,11 +6237,12 @@ defun org-agenda-show-clocking-issues
 	  (setq issue
 		(format
 		 "No end time: (%s)"
-		 (org-duration-from-minutes
-		  (floor
-		   (- (float-time (org-current-time))
-			  (float-time (org-time-string-to-time (match-string 1
-		   60)))
+		 (let ((diff (floor
+		  (- (float-time (org-current-time))
+			 (float-time (org-time-string-to-time (match-string 1
+		  60)))
+   (concat (if (> 0 diff) "-" "")
+   (org-duration-from-minutes (abs diff)
 		face (or (plist-get pl :no-end-time-face) face))
 	  (throw 'next t))
 	(setq ts (match-string 1)

However, I believe it would be more useful (and general) to use a
similar trick to teach org-duration to work with negative durations.

Cheers,
Raffael


Re: [BUG] Hard-coded and inconsistent todo states in org-agenda.el [9.7-pre (release_9.6.12-934-g4d72f3 @ /home/rst/Devel/org-mode/lisp/)]

2023-12-11 Thread Raffael Stocker


Ihor Radchenko  writes:

> May you try the attached patch?

I tried it with a selection of different states (final and not) and it
worked in every case.  Thanks!

Regards,

Raffael



[BUG] Hard-coded and inconsistent todo states in org-agenda.el [9.7-pre (release_9.6.12-934-g4d72f3 @ /home/rst/Devel/org-mode/lisp/)]

2023-12-10 Thread Raffael Stocker


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hi,

org-agenda.el contains the following hard-coded states in ‘org-agenda-to-appt’:

(when (and ok tod (not (string-match "\\`DONE\\|CANCELLED" evt)))...)

I find this confusing as the Org mode manual usually uses “CANCELED”,
with one ‘L’ instead of two.  I believe this should be corrected.  Of
course, ideally the function would take the terminal states from
‘org-todo-keywords’ instead.

Regards,

Raffael

Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.17.8)
Package: Org mode version 9.7-pre (release_9.6.12-934-g4d72f3 @ 
/home/rst/Devel/org-mode/lisp/)



Re: [BUG] Table alignment fails for long lines [9.6.12 ( @ /home/rst/.emacs.d/elpa/org-9.6.12/)]

2023-12-05 Thread Raffael Stocker


Ihor Radchenko  writes:

> Fixed, on bugfix and on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4a7a1f2fe
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f2cb64579

Great, Thanks!



[BUG] Table alignment fails for long lines [9.6.12 ( @ /home/rst/.emacs.d/elpa/org-9.6.12/)]

2023-12-05 Thread Raffael Stocker


Hello Org-mode,

org tables with long text in a field (longer than window width) don't get
aligned correctly.  This seems to be due to the missing X-LIMIT argument to
‘window-text-pixel-size’.  That is, the current usage is something like:

(car (window-text-pixel-size
 nil (line-beginning-position) (point-max)))

If I change that to

(car (window-text-pixel-size
 nil (line-beginning-position) (point-max) t))

things work correctly as lines are not truncated to the visible portion.

This bug also exists in the 9.7-pre version if ‘buffer-text-pixel-size’ is
unbound.

Regards,
Raffael

Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.17.8)
Package: Org mode version 9.6.12 ( @ /home/rst/.emacs.d/elpa/org-9.6.12/)