the start of joy

Eric S. Johansson esj at harvee.org
Sun Feb 6 20:59:33 EST 2011


I used vocola as the glue with Python doing the work

vocola first

# Voice commands for xwin

include Unimacro.vch;

# This really should be just for xemacs but, we will do the best we can

(date | time | log) stamp = stamp.string($1);

---
The heavy lifting
---
#!/bin/env python

# system imports:
import time

# local imports:

# description:
#
#timestamp.py generates timestamp strings for a variety of
#contexts. Ordinary time and date, revision histories etc. the grammar
#is:

# (date | time | log) stamp
#
# "date stamp" yields Feb 6, 2011
# "time stamp" yields 12:04 pm
# "log stamp"  yields 06-feb-2011 esj:

#site control variables
#
user_name = "esj"  # should be derived from system but right now I'm too lazy
time_24 = True #True sets 24 hour format, False sets 12 hour format

# date string format

time_stamp_table = {
     "date": "%b %d, %Y",
     "time_12":  "%I:%M %p",
     "time_24":  "%H:%M",
     "log":  "%s %s: "%("%d-%b-%Y",user_name),
}

# vocola function: stamp.string
def time_stamp_string(date_type):
     """based on the current type, return the appropriate date/time stamp
     """
     working_type = date_type

     if "time" in date_type:
         if time_24:

             working_type = date_type + "_24"
         else:
             working_type = date_type + "_12"


     localtime = time.localtime(time.time())
     result = time.strftime (time_stamp_table[working_type], localtime)
     return result

-----

Now that I've gotten this done, I'm going to hack on the apparently new Emacs 
to-the-release configuration file.



More information about the XEmacs-Beta mailing list