[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-drill and emacspeak



Raman,

I am a little bit stuck when trying to get org-drill working.

I have found that the first issue I am having is that when you start a
drill session a timer line is shown in the message area.  As it ticks
every second emacspeak continually reads it out.

I am not sure how to go about advising such a function. I am trying
initially to turn off
emacspeak-speak-messages but can't quite get the advice correct.

I paste below the function I am trying to advise and my advise,
hopefully if you have a minute you can see what my error is and possibly
offer some advice on a stratagy.


(defadvice  org-drill-presentation-prompt(around emacspeak pre act comp)
  "Inhibit speaking of timer"
  (when (interactive-p)
    (emacspeak-auditory-icon 'ask-question)
    (let ((current-messages-state emacspeak-speak-messages))
      ad-do-it
      (setq emacspeak-speak-messages current-messages-state))
    (emacspeak-auditory-icon 'delete-object)))

(emacspeak-toggle-speak-messages nil)

(defun org-drill-presentation-prompt (&rest fmt-and-args)
  (let* ((item-start-time (current-time))
         (input nil)
         (ch nil)
         (last-second 0)
         (mature-entry-count (+ (length *org-drill-young-mature-entries*)
                                (length *org-drill-old-mature-entries*)
                                (length *org-drill-overdue-entries*)))
         (status (first (org-drill-entry-status)))
         (prompt
          (if fmt-and-args
              (apply 'format
                     (first fmt-and-args)
                     (rest fmt-and-args))
            (concat "Press key for answer, "
                    "e=edit, t=tags, s=skip, q=quit."))))
    (setq prompt
          (format "%s %s %s %s %s %s"
                  (propertize
                   (char-to-string
                    (case status
                      (:new ?N) (:young ?Y) (:old ?o) (:overdue ?!)
                      (:failed ?F) (t ??)))
                   'face `(:foreground
                           ,(case status
                              (:new org-drill-new-count-color)
                              ((:young :old) org-drill-mature-count-color)
                              ((:overdue :failed) org-drill-failed-count-color)
                              (t org-drill-done-count-color))))
                  (propertize
                   (number-to-string (length *org-drill-done-entries*))
                   'face `(:foreground ,org-drill-done-count-color)
                   'help-echo "The number of items you have reviewed this session.")
                  (propertize
                   (number-to-string (+ (length *org-drill-again-entries*)
                                        (length *org-drill-failed-entries*)))
                   'face `(:foreground ,org-drill-failed-count-color)
                   'help-echo (concat "The number of items that you failed, "
                                      "and need to review again."))
                  (propertize
                   (number-to-string mature-entry-count)
                   'face `(:foreground ,org-drill-mature-count-color)
                   'help-echo "The number of old items due for review.")
                  (propertize
                   (number-to-string (length *org-drill-new-entries*))
                   'face `(:foreground ,org-drill-new-count-color)
                   'help-echo (concat "The number of new items that you "
                                      "have never reviewed."))
                  prompt))
    (if (and (eql 'warn org-drill-leech-method)
             (org-drill-entry-leech-p))
        (setq prompt (concat
                      (propertize "!!! LEECH ITEM !!!
You seem to be having a lot of trouble memorising this item.
Consider reformulating the item to make it easier to remember.\n"
                                  'face '(:foreground "red"))
                      prompt)))
    (while (memq ch '(nil ?t))
      (setq ch nil)
      (while (not (input-pending-p))
        (let ((elapsed (time-subtract (current-time) item-start-time)))
          (message (concat (if (>= (time-to-seconds elapsed) (* 60 60))
                               "++:++ "
                             (format-time-string "%M:%S " elapsed))
                           prompt))
          (sit-for 1)))
      (setq input (read-key-sequence nil))
      (if (stringp input) (setq ch (elt input 0)))
      (if (eql ch ?t)
          (org-set-tags-command)))
    (case ch
      (?q nil)
      (?e 'edit)
      (?s 'skip)
      (otherwise t))))


TIA

Bart

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help".



If you have questions about this archive or had problems using it, please send mail to:

priestdo@cs.vassar.edu No Soliciting!

Emacspeak List Archive | 2010 | 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog | Search the archive