Changeset main,3


Ignore:
Timestamp:
04/28/2020 11:05:09 PM (3 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
org-autofocus
revision id:
dsowen@fugue88.ws-20200428230509-z1y5x5lnzqwi1yso
Message:

Hide items that have been passed over

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/org-autofocus.el

    r2 r3  
    2323(defclass org-af--task ()
    2424  ((org :initarg :org)
    25    (marked :initform nil)))
     25   (marked :initform nil)
     26   (passed :initform nil)))
    2627
    2728
    2829(defun org-af--pp (obj)
    2930  "Print the task OBJ in the current buffer at point."
    30   (with-slots (org marked) obj
    31     (insert (if marked "*" " ") " " org)))
     31  (with-slots (org marked passed) obj
     32    (unless passed
     33      (insert (if marked "*" " ") " " org "\n"))))
    3234
    3335
     
    4345        (setq tasks (nconc (org-agenda-get-day-entries f date :todo) tasks))))
    4446
    45     (setq org-af--ewoc (ewoc-create 'org-af--pp "header" "footer"))
     47    (setq org-af--ewoc (ewoc-create 'org-af--pp "header\n" "footer\n" t))
    4648    (dolist (task tasks)
    4749      (ewoc-enter-last org-af--ewoc (make-instance 'org-af--task :org task)))))
     
    5254  (interactive)
    5355  (let* ((node (ewoc-locate org-af--ewoc))
    54          (obj (ewoc-data node)))
    55     (with-slots (marked) obj
    56       (setf marked (not marked))
    57       (ewoc-invalidate org-af--ewoc node))))
     56         (obj (ewoc-data node))
     57         changed)
     58    (let ((marked (not (slot-value obj 'marked))))
     59      (setf (slot-value obj 'marked) marked)
     60      (push node changed)
     61      (let ((node node))
     62        (while (and (setq node (ewoc-prev org-af--ewoc node))
     63                    (setq obj (ewoc-data node))
     64                    (not (slot-value obj 'marked)))
     65          (setf (slot-value obj 'passed) marked)
     66          (push node changed))))
     67    (apply 'ewoc-invalidate org-af--ewoc changed)
     68    (ewoc-goto-node org-af--ewoc node)))
    5869
    5970
Note: See TracChangeset for help on using the changeset viewer.