;;; prayer.el - Prayer viewers.

(setq prayer-dir (expand-file-name "~/cave/green/prayers/"))

(defun canzoni () "View Italian song list"
  (interactive)
  (prayer-view
   "*Canzoni*"
   (expand-file-name "~/cave/green/canzoni/")
   '("50mila"
     "nessun"
     "e-lucevan"
     "vesti"
     "osolemio")))

(defun morning-prayers () "View morning prayers"
  (interactive)
  (prayer-view 
   "*Prayers*"
   prayer-dir
   '("cross.la" 
     "our-father.la" 
     "angelus.la" 
     "st-francis" 
     "holy-spirit" 
     "memorare" 
     "anima-christi" 
     "dr-richardson" 
     "lorica" 
     "st-michael"
     "glory-be.la")))

(defun beginning-prayers () 
  "View Beginning Prayers (Raymond L. Richmond. 'Learning to Pray.' <http://chastitysf.guidetopsychology.com/howtopray.htm>.)"
  (interactive)
  (prayer-view
   "*Prayers*"
   prayer-dir
   '("cross" 
     "cross.la" 
     "our-father" 
     "our-father.la" 
     "hail-mary" 
     "hail-mary.la" 
     "glory-be" 
     "glory-be.la" 
     "st-francis" 
     "holy-spirit" 
     "memorare" 
     "anima-christi" 
     "dr-richardson")))

(defun prayer-sep () "Insert separator text in buffer"
  (insert "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"))

(defun prayer-view (bname tdir text-list) 
  "Concatenate and view prayer text files"
  (let ((buf bname))
    (switch-to-buffer buf)
    (insert-file-contents (concat tdir (car text-list) ".txt"))
    (dolist (fn (cdr text-list))
      (goto-char (point-max))
      (prayer-sep)
      (goto-char (point-max))
      (insert-file-contents (concat tdir fn ".txt")))
    (goto-char (point-min))
    (view-buffer buf 'kill-buffer)))