[TxMt] Re: GTDalt Questions

Piero D'Ancona pierodancona at gmail.com
Thu Nov 30 00:32:12 UTC 2006


Charilaos Skiadas <skiadas at ...> writes:
> On Nov 29, 2006, at 10:32 AM, Lawrence Goodman wrote:
> > Thanks again for this fabulous bundle. A few small issues:
> >
> > 1) I was wondering if you could post the script you wrote in an  
> > earlier version of the bundle for moving the date ahead a day with  
> > a keystroke. It would be very handy for me.
> 
> Out of curiosity, why do you find this command useful? One of the  
> reasons we removed it is that we didn't think it was used much. What  
> workflow do you find benefiting from it?

I also found the command quite useful (e.g., when jotting down
a note containing a date I write today's date with a shortcut and
then shift forwards or backwards as needed). As Haris says, it
is quite easy to reproduce the commands in ruby.
The following moves ahead one day:

#!/usr/bin/env ruby
require 'date'
print STDIN.read.sub(/(\d{4}-\d{2}-\d{2})/) {|text| "#{Date.parse(text)+1}"}

Use with Input: selected text or Line, Output: replace selected text.
This command acts on a date in the format 2005-11-29 (if two dates
are present on the line, only the first one is shifted). 
To decrease the day count by one, the command is of course

#!/usr/bin/env ruby
require 'date'
print STDIN.read.sub(/(\d{4}-\d{2}-\d{2})/) {|text| "#{Date.parse(text)-1}"}

and to insert today's date (with weekday)

#!/usr/bin/env ruby
print Time.now.strftime("%Y-%m-%d %a ")

(Input: none, Output: Insert as text). Very simple.

Ruby is impressive, it makes everything so easy. 
As an exercise I just finished an I-Ching command
(including interpretation, Wilhelm-style :)))
If anyone is interested...

2) Also for me the checkbox works in strange ways. It is
not consistent when the gtd window is updated after clicking
in the checkbox; sometimes immediately, sometimes
only after focus-out focus-in, and sometimes I must
close the window and re-open it. But maybe I mis-interpreted
something as usual

Piero






More information about the textmate mailing list