emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] colview: Display active time stamps as inactive


From: Kyle Meyer
Subject: [PATCH] colview: Display active time stamps as inactive
Date: Tue, 12 May 2020 02:08:47 +0000

Kyle Meyer writes:

> Nicolas Goaziou writes:
>
>> IIRC, date computations in the spreadsheet return inactive timestamps.
>> So, if we don't want to conform to the documentation, we could insert an
>> inactive time-stamp instead, to be on the safe side.
>>
>> WDYT?
>
> Sounds good to me.  I should be able to find time in the next day or two
> to look into it.

Okay, here's a patch for that to go along with the documentation patch.

-- >8 --
Subject: [PATCH] colview: Display active time stamps as inactive

* lisp/org-colview.el (org-columns--displayed-value): Convert active
time stamp values to inactive time stamps to avoid duplicate entries
in the agenda.
* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add
tests.
---
 lisp/org-colview.el              |  2 ++
 testing/lisp/test-org-colview.el | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 3569b231b..3e5920ccd 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -257,6 +257,8 @@ (defun org-columns--displayed-value (spec value &optional 
no-star)
                                          (if org-hide-leading-stars ?\s ?*))
                             "* "))))
           (concat stars (org-link-display-format value))))
+       (`(,(or "DEADLINE" "SCHEDULED" "TIMESTAMP") . ,_)
+        (replace-regexp-in-string org-ts-regexp "[\\1]" value))
        (`(,_ ,_ ,_ ,_ nil) value)
        ;; If PRINTF is set, assume we are displaying a number and
        ;; obey to the format string.
diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index ed75090df..7612074b5 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -1519,7 +1519,24 @@ (ert-deftest test-org-colview/dblock ()
     (org-test-with-temp-text
         "* H src_emacs-lisp{(+ 1 1)} 1\n<point>#+BEGIN: columnview\n#+END:"
       (let ((org-columns-default-format "%ITEM")) (org-update-dblock))
-      (buffer-substring-no-properties (point) (point-max))))))
+      (buffer-substring-no-properties (point) (point-max)))))
+  ;; Active time stamps are displayed as inactive.
+  (should
+   (equal
+    "#+BEGIN: columnview
+| ITEM | d                | s                | t                |
+|------+------------------+------------------+------------------|
+| H    | [2020-05-14 Thu] | [2020-05-11 Mon] | [2020-06-10 Wed] |
+#+END:"
+    (org-test-with-temp-text
+     "* H
+SCHEDULED: <2020-05-11 Mon> DEADLINE: <2020-05-14 Thu>
+<2020-06-10 Wed>
+<point>#+BEGIN: columnview\n#+END:"
+     (let ((org-columns-default-format
+           "%ITEM %DEADLINE(d) %SCHEDULED(s) %TIMESTAMP(t)"))
+       (org-update-dblock))
+     (buffer-substring-no-properties (point) (point-max))))))
 
 (provide 'test-org-colview)
 ;;; test-org-colview.el ends here

base-commit: 3bbaca166052c4761a1bc8227496b23dc157bf96
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]