-
Notifications
You must be signed in to change notification settings - Fork 2
/
pjb-dodo.el
68 lines (58 loc) · 2.17 KB
/
pjb-dodo.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;;;; -*- mode:emacs-lisp;coding:utf-8 -*-
;;;;****************************************************************************
;;;;FILE: pjb-dodo.el
;;;;LANGUAGE: emacs lisp
;;;;SYSTEM: POSIX
;;;;USER-INTERFACE: NONE
;;;;DESCRIPTION
;;;;
;;;; Trace daily start and stop times and plot them.
;;;;
;;;;AUTHORS
;;;; <PJB> Pascal Bourguignon <[email protected]>
;;;;MODIFICATIONS
;;;; 2005-09-22 <PJB> Created.
;;;;BUGS
;;;;LEGAL
;;;; GPL
;;;;
;;;; Copyright Pascal Bourguignon 2005 - 2011
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License
;;;; as published by the Free Software Foundation; either version
;;;; 2 of the License, or (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be
;;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;;; PURPOSE. See the GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public
;;;; License along with this program; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
;;;;****************************************************************************
(require 'pjb-cl)
(defparameter *schedule-file* "~/.sleep-schedule")
(defun pjb-log-sleep (file tag)
(set-buffer (get-buffer-create " *log-time*"))
(mark-whole-buffer)
(erase-buffer)
(MULTIPLE-VALUE-BIND (sec min hou day mon yea dow dst zone)
(DECODE-UNIVERSAL-TIME (GET-UNIVERSAL-TIME))
(insert (format "(%s %d %d %d %d %d %d %d/%d)\n"
tag yea mon day hou min sec (truncate (* 3600 zone)) 3600)))
(write-region (point-min) (point-max) file :append))
(defun pjb-will-sleep ()
(interactive)
(pjb-log-sleep *schedule-file* :start))
(defun pjb-did-sleep ()
(interactive)
(pjb-log-sleep *schedule-file* :stop))
(defun pjb-plot-sleep ()
(interactive)
(shell-command "~/bin/sleep-schedule.lisp")
(other-window 1)
(delete-other-windows)
(goto-char (point-max)))