emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Manipulating Dates Automatically in a Headline
@ 2014-08-11 18:20 Matt Price
  2014-08-13 13:37 ` Matt Price
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Price @ 2014-08-11 18:20 UTC (permalink / raw)
  To: Org Mode

Hi Everyone,

I've asked this before, but that was a year or two ago and am hoping
someone has an idea now, perhaps involving babel or something.

every year at this time I rewrite a set of syllabi. I do a lot of
moving htings around while i'm oding it, and at the end I have to
enter a whole bunch of dates somewhat laboriously.  I have headlines
that look about like either like this:

-----------------
* Outline
** Week 1: Topic Title (<2013-09-10>)
    Longish Description
*** Reading
- Article 1
- Article 2
*** Lab
*** Notes
-----------------------------------

or like this:
----------------------
* Outline
** Week 1: <2013-09-09>
*** Seminar: Technology and Society  (<2013-09-10>)
*** Reading
- Article 1
- Article 2
*** Plenary: Global Citizenship (<2013-09-13>)
--------------------

I would like to replace the timestamps with code that dynamically
generates timestamps based on the value either in the last sibling
headline, or the parent headline.  It seems to me this ought to be
possible, but I'm not at all sure how to do it.  i would really
appreciate any guidance.  thanks!

Matt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Manipulating Dates Automatically in a Headline
  2014-08-11 18:20 Manipulating Dates Automatically in a Headline Matt Price
@ 2014-08-13 13:37 ` Matt Price
  2014-08-13 19:29   ` Samuel Wales
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matt Price @ 2014-08-13 13:37 UTC (permalink / raw)
  To: Org Mode

It's been a couple of days so I'll try restate this question more
clearly.  I'm hoping it's possible to do something like this:

* Week one (<2014-09-09>)
* Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)

I don't have much experience with babel so I'm not sure how to do
this, but if it's possible I would love some hints.  Thanks as always,

Matt


On Mon, Aug 11, 2014 at 2:20 PM, Matt Price <moptop99@gmail.com> wrote:
> Hi Everyone,
>
> I've asked this before, but that was a year or two ago and am hoping
> someone has an idea now, perhaps involving babel or something.
>
> every year at this time I rewrite a set of syllabi. I do a lot of
> moving htings around while i'm oding it, and at the end I have to
> enter a whole bunch of dates somewhat laboriously.  I have headlines
> that look about like either like this:
>
> -----------------
> * Outline
> ** Week 1: Topic Title (<2013-09-10>)
>     Longish Description
> *** Reading
> - Article 1
> - Article 2
> *** Lab
> *** Notes
> -----------------------------------
>
> or like this:
> ----------------------
> * Outline
> ** Week 1: <2013-09-09>
> *** Seminar: Technology and Society  (<2013-09-10>)
> *** Reading
> - Article 1
> - Article 2
> *** Plenary: Global Citizenship (<2013-09-13>)
> --------------------
>
> I would like to replace the timestamps with code that dynamically
> generates timestamps based on the value either in the last sibling
> headline, or the parent headline.  It seems to me this ought to be
> possible, but I'm not at all sure how to do it.  i would really
> appreciate any guidance.  thanks!
>
> Matt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Manipulating Dates Automatically in a Headline
  2014-08-13 13:37 ` Matt Price
@ 2014-08-13 19:29   ` Samuel Wales
  2014-08-13 23:23   ` John Kitchin
  2014-08-15  1:14   ` John Kitchin
  2 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2014-08-13 19:29 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

this might be entirely wrong as an answer, but org has a command to
clone a task with a date increment.  i wonder if that would help.

On 8/13/14, Matt Price <moptop99@gmail.com> wrote:
> * Week one (<2014-09-09>)
> * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
> WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Manipulating Dates Automatically in a Headline
  2014-08-13 13:37 ` Matt Price
  2014-08-13 19:29   ` Samuel Wales
@ 2014-08-13 23:23   ` John Kitchin
  2014-08-15  1:14   ` John Kitchin
  2 siblings, 0 replies; 5+ messages in thread
From: John Kitchin @ 2014-08-13 23:23 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Matt Price <moptop99@gmail.com> writes:

I have not done that exactly, but here is some code that does manipulate
timestamps:
http://kitchingroup.cheme.cmu.edu/blog/2014/02/05/Add-time-to-a-deadline/

It is not quite what you want, but it might be a good start.


> It's been a couple of days so I'll try restate this question more
> clearly.  I'm hoping it's possible to do something like this:
>
> * Week one (<2014-09-09>)
> * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
> WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)
>
> I don't have much experience with babel so I'm not sure how to do
> this, but if it's possible I would love some hints.  Thanks as always,
>
> Matt
>
>
> On Mon, Aug 11, 2014 at 2:20 PM, Matt Price <moptop99@gmail.com> wrote:
>> Hi Everyone,
>>
>> I've asked this before, but that was a year or two ago and am hoping
>> someone has an idea now, perhaps involving babel or something.
>>
>> every year at this time I rewrite a set of syllabi. I do a lot of
>> moving htings around while i'm oding it, and at the end I have to
>> enter a whole bunch of dates somewhat laboriously.  I have headlines
>> that look about like either like this:
>>
>> -----------------
>> * Outline
>> ** Week 1: Topic Title (<2013-09-10>)
>>     Longish Description
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Lab
>> *** Notes
>> -----------------------------------
>>
>> or like this:
>> ----------------------
>> * Outline
>> ** Week 1: <2013-09-09>
>> *** Seminar: Technology and Society  (<2013-09-10>)
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Plenary: Global Citizenship (<2013-09-13>)
>> --------------------
>>
>> I would like to replace the timestamps with code that dynamically
>> generates timestamps based on the value either in the last sibling
>> headline, or the parent headline.  It seems to me this ought to be
>> possible, but I'm not at all sure how to do it.  i would really
>> appreciate any guidance.  thanks!
>>
>> Matt
>
>

-- 
-----------------------------------
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Manipulating Dates Automatically in a Headline
  2014-08-13 13:37 ` Matt Price
  2014-08-13 19:29   ` Samuel Wales
  2014-08-13 23:23   ` John Kitchin
@ 2014-08-15  1:14   ` John Kitchin
  2 siblings, 0 replies; 5+ messages in thread
From: John Kitchin @ 2014-08-15  1:14 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Matt Price <moptop99@gmail.com> writes:


I think this is approximately what you want:

#+BEGIN_SRC emacs-lisp 
(defun insert-ts+1w ()
  "Insert a timestamp at point that is one week later than the
last timestamp found in the buffer."
  (interactive)
  (let ((last-ts (car (last (org-element-map (org-element-parse-buffer) 'timestamp
			      (lambda (timestamp)
				(org-element-property :raw-value timestamp)))))))
    (insert last-ts)
    (backward-char 2)
    (org-timestamp-change +7 'day)
    ))
#+END_SRC

It is an interactive command you can run with M-x insert-ts+1w at the
point you want to insert the new headline.

> It's been a couple of days so I'll try restate this question more
> clearly.  I'm hoping it's possible to do something like this:
>
> * Week one (<2014-09-09>)
> * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
> WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)
>
> I don't have much experience with babel so I'm not sure how to do
> this, but if it's possible I would love some hints.  Thanks as always,
>
> Matt
>
>
> On Mon, Aug 11, 2014 at 2:20 PM, Matt Price <moptop99@gmail.com> wrote:
>> Hi Everyone,
>>
>> I've asked this before, but that was a year or two ago and am hoping
>> someone has an idea now, perhaps involving babel or something.
>>
>> every year at this time I rewrite a set of syllabi. I do a lot of
>> moving htings around while i'm oding it, and at the end I have to
>> enter a whole bunch of dates somewhat laboriously.  I have headlines
>> that look about like either like this:
>>
>> -----------------
>> * Outline
>> ** Week 1: Topic Title (<2013-09-10>)
>>     Longish Description
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Lab
>> *** Notes
>> -----------------------------------
>>
>> or like this:
>> ----------------------
>> * Outline
>> ** Week 1: <2013-09-09>
>> *** Seminar: Technology and Society  (<2013-09-10>)
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Plenary: Global Citizenship (<2013-09-13>)
>> --------------------
>>
>> I would like to replace the timestamps with code that dynamically
>> generates timestamps based on the value either in the last sibling
>> headline, or the parent headline.  It seems to me this ought to be
>> possible, but I'm not at all sure how to do it.  i would really
>> appreciate any guidance.  thanks!
>>
>> Matt
>
>

-- 
-----------------------------------
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-15  1:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11 18:20 Manipulating Dates Automatically in a Headline Matt Price
2014-08-13 13:37 ` Matt Price
2014-08-13 19:29   ` Samuel Wales
2014-08-13 23:23   ` John Kitchin
2014-08-15  1:14   ` John Kitchin

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).