* Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview
@ 2022-06-23 23:44 Mekeor Melire
2022-07-01 12:06 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Mekeor Melire @ 2022-06-23 23:44 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I'm trying to customize org-columns-modify-value-for-display-function in
order to change how time-stamps are displayed. I tried this kind of
function:
--8<---------------cut here---------------start------------->8---
(lambda (column-title value)
(pcase column-title
((or "SCHEDULED" "TIMESTAMP" "DEADLINE")
(if value
(format-time-string "%02m'%d %a %R"
(org-read-date t t value))
""))
(_ nil)))
--8<---------------cut here---------------end--------------->8---
But it results in empty (nil, I guess) time-stamps being displayed as
the current time; and non-nil time-stamps being displayed with the
current hour and minute. What's wrong?
Kind regards
Mekeor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview
2022-06-23 23:44 Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview Mekeor Melire
@ 2022-07-01 12:06 ` Ihor Radchenko
2022-07-01 12:48 ` Max Nikulin
2022-07-04 14:44 ` Mekeor Melire
0 siblings, 2 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-01 12:06 UTC (permalink / raw)
To: Mekeor Melire; +Cc: emacs-orgmode
Mekeor Melire <mekeor@posteo.de> writes:
> But it results in empty (nil, I guess) time-stamps being displayed as
> the current time; and non-nil time-stamps being displayed with the
> current hour and minute. What's wrong?
Empty time-stamps will be literally empty: "" (that is: empty string).
(if "" 1 2) will return 1. That's why you got unexpected result.
You could instead use (if (and value (not (string-empty-p value))) ...)
Best,
Ihor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview
2022-07-01 12:06 ` Ihor Radchenko
@ 2022-07-01 12:48 ` Max Nikulin
2022-07-04 14:44 ` Mekeor Melire
1 sibling, 0 replies; 4+ messages in thread
From: Max Nikulin @ 2022-07-01 12:48 UTC (permalink / raw)
To: emacs-orgmode
On 01/07/2022 19:06, Ihor Radchenko wrote:
>
> You could instead use (if (and value (not (string-empty-p value))) ...)
`org-string-nw-p' is not identical to this expression, but it likely
still can be used.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview
2022-07-01 12:06 ` Ihor Radchenko
2022-07-01 12:48 ` Max Nikulin
@ 2022-07-04 14:44 ` Mekeor Melire
1 sibling, 0 replies; 4+ messages in thread
From: Mekeor Melire @ 2022-07-04 14:44 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
2022-07-01 / 20:06 / yantar92@gmail.com:
> Mekeor Melire <mekeor@posteo.de> writes:
>
> > But it results in empty (nil, I guess) time-stamps being displayed as
> > the current time; and non-nil time-stamps being displayed with the
> > current hour and minute. What's wrong?
>
> Empty time-stamps will be literally empty: "" (that is: empty string).
> (if "" 1 2) will return 1. That's why you got unexpected result.
> You could instead use (if (and value (not (string-empty-p value))) ...)
>
> Best,
> Ihor
thank you very much, ihor. this worked! :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-04 15:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 23:44 Customizing org-columns-modify-value-for-display-function to shorten time-stamps in colview Mekeor Melire
2022-07-01 12:06 ` Ihor Radchenko
2022-07-01 12:48 ` Max Nikulin
2022-07-04 14:44 ` Mekeor Melire
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).