Changeset main,13 for main


Ignore:
Timestamp:
05/04/2020 01:16:18 AM (5 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
org-autofocus
revision id:
dsowen@fugue88.ws-20200504011618-08dkgem5x2dqkbsb
Message:

Cleaned-up commented code and obsolete REQUIREs, removed unneeded NO-REDISPLAY param, added docstrings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/org-autofocus.el

    r12 r13  
    1010
    1111;;; Code:
    12 
    13 (require 'calendar)
    14 (require 'eieio)
    15 (require 'ewoc)
    1612
    1713(require 'org-agenda)
     
    106102
    107103
    108 (defun org-af-defer (&optional no-redisplay)
     104(defun org-af-defer ()
    109105  "Defer the current task and update the display, unless NO-REDISPLAY."
    110106  (interactive)
     
    139135
    140136(defun org-af-complete ()
     137  "Complete to current task.
     138The task is unmarked (if marked), completed by Org, touched, then
     139sorted to the end of the list."
    141140  (interactive)
    142141  (org-af--beg-of-task)
     
    144143    (org-af-mark))
    145144  (org-agenda-todo)
    146   (org-af-defer t))
     145  (org-af-defer))
    147146
    148147
     
    155154
    156155(defun org-af--touched (entry)
     156  "Touch ENTRY by setting its ``TOUCHED'' property to the current time."
    157157  (let* ((marker (get-text-property 0 'org-hd-marker entry))
    158158         (touched (org-entry-get marker "TOUCHED")))
     
    176176
    177177
    178 (define-minor-mode org-autofocus-mode nil nil " AF" org-autofocus-mode-map
    179   ;;(setq org-agenda-redo-command '(org-autofocus))
    180   )
     178(define-minor-mode org-autofocus-mode nil nil " AF" org-autofocus-mode-map)
    181179
    182180
    183181(defun org-autofocus ()
     182  "Display the Org Agenda Todo list in AutoFocus mode."
    184183  (interactive)
    185184  (let ((org-agenda-cmp-user-defined 'org-af--cmp)
     
    189188
    190189
    191 (add-hook 'org-agenda-mode-hook 'org-autofocus-mode)
    192 (remove-hook 'org-agenda-mode-hook 'org-autofocus-mode)
    193 
    194 
    195 ;; (defvar-local org-af--ewoc nil)
    196 
    197 
    198 ;; (defclass org-af--task ()
    199 ;;   ((org :initarg :org)
    200 ;;    (marked :initform nil)
    201 ;;    (passed :initform nil)))
    202 
    203 
    204 ;; (defun org-af--pp (obj)
    205 ;;   "Print the task OBJ in the current buffer at point."
    206 ;;   (with-slots (org marked passed) obj
    207 ;;     (when (or marked (not passed))
    208 ;;       (insert (if marked "*" " ")
    209 ;;               " "
    210 ;;               (if passed
    211 ;;                   (propertize org 'face 'org-agenda-dimmed-todo-face)
    212 ;;                 org)
    213 ;;               "\n"))))
    214 
    215 
    216 ;; (define-derived-mode org-autofocus-mode special-mode "Org AF" nil
    217 ;;   (let ((inhibit-read-only t)
    218 ;;         (date (calendar-current-date))
    219 ;;         tasks)
    220 ;;     (setq buffer-undo-list t)
    221 
    222 ;;     (dolist (f (org-agenda-files))
    223 ;;       (catch 'nextfile
    224 ;;      (org-check-agenda-file f)
    225 ;;      (setq tasks (nconc (org-agenda-get-day-entries f date :todo) tasks))))
    226 
    227 ;;     (setq org-af--ewoc (ewoc-create 'org-af--pp "header\n" "footer\n" t))
    228 ;;     (dolist (task tasks)
    229 ;;       (ewoc-enter-last org-af--ewoc (make-instance 'org-af--task :org task)))))
    230 
    231 
    232 ;; (defun org-af--mark ()
    233 ;;   "Toggle whether the task at point is marked."
    234 ;;   (interactive)
    235 ;;   (let* ((node (ewoc-locate org-af--ewoc))
    236 ;;          (obj (ewoc-data node))
    237 ;;          changed)
    238 ;;     (unless (slot-value obj 'passed)
    239 ;;       (let ((marked (not (slot-value obj 'marked))))
    240 ;;         (setf (slot-value obj 'marked) marked)
    241 ;;         (push node changed)
    242 ;;         (let ((node node))
    243 ;;           (while (and (setf node (ewoc-prev org-af--ewoc node))
    244 ;;                       (setf obj (ewoc-data node))
    245 ;;                       (not (slot-value obj 'marked)))
    246 ;;             (setf (slot-value obj 'passed) marked)
    247 ;;             (push node changed))
    248 ;;           (when node
    249 ;;             (setf (slot-value obj 'passed) marked)
    250 ;;             (push node changed))))
    251 ;;       (apply 'ewoc-invalidate org-af--ewoc changed)
    252 ;;       (ewoc-goto-node org-af--ewoc node))))
    253 
    254 
    255 ;; (defun org-af--complete ()
    256 ;;   "Complete the task at point, if it's marked and not passed over."
    257 ;;   (interactive)
    258 ;;   (let* ((node (ewoc-locate org-af--ewoc))
    259 ;;          (obj (ewoc-data node)))
    260 ;;     (unless (and nil (or (slot-value obj 'passed)
    261 ;;                 (not (slot-value obj 'marked))))
    262 ;;       (org-agenda-todo)
    263 ;;       (org-autofocus-mode))))
    264 
    265 
    266 ;; (define-key org-autofocus-mode-map "." 'org-af--mark)
    267 ;; (define-key org-autofocus-mode-map "c" 'org-af--complete)
    268 
    269 
    270 ;; ;;;###autoload
    271 ;; (defun org-autofocus ()
    272 ;;   "Show the AutoFocus buffer; create it if necessary."
    273 ;;   (interactive)
    274 ;;   (pop-to-buffer (get-buffer-create "*Org AutoFocus*"))
    275 ;;   (org-autofocus-mode))
    276 
    277 
    278190(provide 'org-autofocus)
    279191;;; org-autofocus.el ends here
Note: See TracChangeset for help on using the changeset viewer.