From: Matt Price <moptop99@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Andrei Beliankou <arbox@yandex.ru>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Time shifting functions
Date: Fri, 27 Apr 2018 11:53:04 -0400 [thread overview]
Message-ID: <CAN_Dec_snk-xwOJAXSXdtyHXyJCic8_mfkFGzz8SsC_-9vJB9g@mail.gmail.com> (raw)
In-Reply-To: <878t99sfsf.fsf@bzg.fr>
[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]
On Thu, Apr 26, 2018 at 7:34 PM, Bastien <bzg@gnu.org> wrote:
> Hi Andrei,
>
> Andrei Beliankou <arbox@yandex.ru> writes:
>
> > I wonder if Org-mode has a convinient function to shift a timestamp with
> > a (weekly) repeating interval by that interval.
>
> Actually the same way `org-read-date' reads the time in the timestamp
> it could also read a repeater interval, so that C-c C-s would present
> you with this repeater interval by default.
>
> Would that make sense for you?
>
>
Huh, that sounds interesting. What I did was define this function:
;; this is the one I'm currently using
(defun get-ts+7 ()
"returns a string of the form <%Y-%m-d %a> where the date elements are 7
days later
than the previous timestamp in the buffer. No error checking or anything
yet."
(interactive)
(let ((base-date (save-excursion
(re-search-backward
(org-re-timestamp 'all))
(match-string 0)))
(result nil))
(format-time-string "<%Y-%m-%d %a>"
(time-add
(date-to-time base-date) (days-to-time (1+ 7))))
))
And then I use this macro:
#+MACRO: ts (eval (get-ts+7))
And then my headings look like this:
* Week {{{n}}} (<2017-09-11 Mon>):Intro. On Discussion.
* Week {{{n}}} ({{{ts}}}): What is a River?
* Week {{{n}}} ({{{ts}}}): Rivers in the Broad Sweep of Time
It's not easy to look at in its org-native form, but it's pretty good on
export.
[-- Attachment #2: Type: text/html, Size: 2367 bytes --]
prev parent reply other threads:[~2018-04-27 15:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 8:45 Time shifting functions Andrei Beliankou
2018-04-26 23:34 ` Bastien
2018-04-27 15:53 ` Matt Price [this message]
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=CAN_Dec_snk-xwOJAXSXdtyHXyJCic8_mfkFGzz8SsC_-9vJB9g@mail.gmail.com \
--to=moptop99@gmail.com \
--cc=arbox@yandex.ru \
--cc=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
/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).