emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: emacs-orgmode@gnu.org
Cc: orgmode@pm.me
Subject: [PATCH] colview: Display active time stamps as inactive
Date: Tue, 12 May 2020 02:08:47 +0000	[thread overview]
Message-ID: <87zhadewgg.fsf@kyleam.com> (raw)
In-Reply-To: <87k11i61v2.fsf@kyleam.com>

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	other threads:[~2020-05-12  2:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-10 15:29 Possible bug with columnview and active dates Org Mode
2020-05-10 19:13 ` Kyle Meyer
2020-05-10 20:11   ` Kyle Meyer
2020-05-10 20:55     ` Kyle Meyer
2020-05-11  6:59       ` Nicolas Goaziou
2020-05-11 13:24         ` Kyle Meyer
2020-05-12  2:08           ` Kyle Meyer [this message]
2020-05-13  2:51             ` [PATCH] colview: Display active time stamps as inactive Kyle Meyer
2020-05-13  8:01               ` Nicolas Goaziou
2020-05-10 21:31     ` [PATCH] manual: Fix special property descriptions for DEADLINE/SCHEDULED Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhadewgg.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=orgmode@pm.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).