You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB
EmacsLisp

(setq periodfile (concat (file-name-as-directory fileroot) "admin/emacs/period.org"))
(defun periodise ()
"Return day of menstrual cycle"
(find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer
(setq theyear (string-to-number (buffer-substring-no-properties 2 6)))
(setq themonth (string-to-number (buffer-substring-no-properties 7 9)))
(setq thedate (string-to-number (buffer-substring-no-properties 10 12)))
(kill-buffer thebuffer))
(setq dayof nil)
(push theyear dayof)
(push thedate dayof)
(push themonth dayof)
(setq thatday (calendar-absolute-from-gregorian dayof))
(setq today (calendar-absolute-from-gregorian (calendar-current-date)))
(setq days (+ 1 (- today thatday)))
(insert (concat "Day " (format "%S" days))))
(defun menstruate ()
"Mark beginning of menstrual cycle"
(interactive)
(find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer
(goto-char (point-min))
(insert "\n")
(goto-char (point-min))
(org-time-stamp '(16) nil)
(write-file periodfile)
(kill-buffer thebuffer)))