Index: main/org-autofocus.el
===================================================================
--- main/org-autofocus.el	(revision main,12)
+++ main/org-autofocus.el	(revision main,13)
@@ -10,8 +10,4 @@
 
 ;;; Code:
-
-(require 'calendar)
-(require 'eieio)
-(require 'ewoc)
 
 (require 'org-agenda)
@@ -106,5 +102,5 @@
 
 
-(defun org-af-defer (&optional no-redisplay)
+(defun org-af-defer ()
   "Defer the current task and update the display, unless NO-REDISPLAY."
   (interactive)
@@ -139,4 +135,7 @@
 
 (defun org-af-complete ()
+  "Complete to current task.
+The task is unmarked (if marked), completed by Org, touched, then
+sorted to the end of the list."
   (interactive)
   (org-af--beg-of-task)
@@ -144,5 +143,5 @@
     (org-af-mark))
   (org-agenda-todo)
-  (org-af-defer t))
+  (org-af-defer))
 
 
@@ -155,4 +154,5 @@
 
 (defun org-af--touched (entry)
+  "Touch ENTRY by setting its ``TOUCHED'' property to the current time."
   (let* ((marker (get-text-property 0 'org-hd-marker entry))
          (touched (org-entry-get marker "TOUCHED")))
@@ -176,10 +176,9 @@
 
 
-(define-minor-mode org-autofocus-mode nil nil " AF" org-autofocus-mode-map
-  ;;(setq org-agenda-redo-command '(org-autofocus))
-  )
+(define-minor-mode org-autofocus-mode nil nil " AF" org-autofocus-mode-map)
 
 
 (defun org-autofocus ()
+  "Display the Org Agenda Todo list in AutoFocus mode."
   (interactive)
   (let ((org-agenda-cmp-user-defined 'org-af--cmp)
@@ -189,91 +188,4 @@
 
 
-(add-hook 'org-agenda-mode-hook 'org-autofocus-mode)
-(remove-hook 'org-agenda-mode-hook 'org-autofocus-mode)
-
-
-;; (defvar-local org-af--ewoc nil)
-
-
-;; (defclass org-af--task ()
-;;   ((org :initarg :org)
-;;    (marked :initform nil)
-;;    (passed :initform nil)))
-
-
-;; (defun org-af--pp (obj)
-;;   "Print the task OBJ in the current buffer at point."
-;;   (with-slots (org marked passed) obj
-;;     (when (or marked (not passed))
-;;       (insert (if marked "*" " ")
-;;               " "
-;;               (if passed
-;;                   (propertize org 'face 'org-agenda-dimmed-todo-face)
-;;                 org)
-;;               "\n"))))
-
-
-;; (define-derived-mode org-autofocus-mode special-mode "Org AF" nil
-;;   (let ((inhibit-read-only t)
-;;         (date (calendar-current-date))
-;;         tasks)
-;;     (setq buffer-undo-list t)
-
-;;     (dolist (f (org-agenda-files))
-;;       (catch 'nextfile
-;; 	(org-check-agenda-file f)
-;; 	(setq tasks (nconc (org-agenda-get-day-entries f date :todo) tasks))))
-
-;;     (setq org-af--ewoc (ewoc-create 'org-af--pp "header\n" "footer\n" t))
-;;     (dolist (task tasks)
-;;       (ewoc-enter-last org-af--ewoc (make-instance 'org-af--task :org task)))))
-
-
-;; (defun org-af--mark ()
-;;   "Toggle whether the task at point is marked."
-;;   (interactive)
-;;   (let* ((node (ewoc-locate org-af--ewoc))
-;;          (obj (ewoc-data node))
-;;          changed)
-;;     (unless (slot-value obj 'passed)
-;;       (let ((marked (not (slot-value obj 'marked))))
-;;         (setf (slot-value obj 'marked) marked)
-;;         (push node changed)
-;;         (let ((node node))
-;;           (while (and (setf node (ewoc-prev org-af--ewoc node))
-;;                       (setf obj (ewoc-data node))
-;;                       (not (slot-value obj 'marked)))
-;;             (setf (slot-value obj 'passed) marked)
-;;             (push node changed))
-;;           (when node
-;;             (setf (slot-value obj 'passed) marked)
-;;             (push node changed))))
-;;       (apply 'ewoc-invalidate org-af--ewoc changed)
-;;       (ewoc-goto-node org-af--ewoc node))))
-
-
-;; (defun org-af--complete ()
-;;   "Complete the task at point, if it's marked and not passed over."
-;;   (interactive)
-;;   (let* ((node (ewoc-locate org-af--ewoc))
-;;          (obj (ewoc-data node)))
-;;     (unless (and nil (or (slot-value obj 'passed)
-;;                 (not (slot-value obj 'marked))))
-;;       (org-agenda-todo)
-;;       (org-autofocus-mode))))
-
-
-;; (define-key org-autofocus-mode-map "." 'org-af--mark)
-;; (define-key org-autofocus-mode-map "c" 'org-af--complete)
-
-
-;; ;;;###autoload
-;; (defun org-autofocus ()
-;;   "Show the AutoFocus buffer; create it if necessary."
-;;   (interactive)
-;;   (pop-to-buffer (get-buffer-create "*Org AutoFocus*"))
-;;   (org-autofocus-mode))
-
-
 (provide 'org-autofocus)
 ;;; org-autofocus.el ends here
