Skip to content

Commit

Permalink
down to 6 failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevoke committed Apr 1, 2023
1 parent 00055d9 commit 09344fd
Show file tree
Hide file tree
Showing 25 changed files with 385 additions and 349 deletions.
1 change: 1 addition & 0 deletions Eldev
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
(setq eldev-test-framework 'buttercup)

(eldev-add-extra-dependencies 'test 'with-simulated-input)
(eldev-add-extra-dependencies 'test 'dash)
4 changes: 4 additions & 0 deletions changes-for-3.0.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* org-gtd-process-mode is now org-gtd-clarify-mode
* org-gtd-process-map is now org-gtd-clarify-map
* org-gtd-choose is now org-gtd-organize
* you can now clarify single items with org-gtd-clarify-item
1 change: 1 addition & 0 deletions dev/.emacs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
(assq-delete-all 'org package--builtin-versions)

(straight-use-package '(org-gtd :type git :host github :repo "trevoke/org-gtd.el"))
(setq org-gtd-update-ack "2.1.0")
(require 'org-gtd)

;; (use-package org
Expand Down
2 changes: 1 addition & 1 deletion doc/org-gtd.org
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Make sure you also read about sub-package configuration: [[*Required configurati
There's an important keymap you'll want to make the flow of processing the inbox smoother. To limit impact on your emacs configuration, there is a specific keymap you can use. The function you'll want to bind is ~org-gtd-choose~. I suggest ~C-c c~, as in the following example.

#+begin_src elisp
(define-key org-gtd-process-map (kbd "C-c c") #'org-gtd-choose)
(define-key org-gtd-clarify-map (kbd "C-c c") #'org-gtd-organize)
#+end_src

For other keybindings, do what you need. My bindings use ~C-c d~ as a prefix, i.e.:
Expand Down
8 changes: 7 additions & 1 deletion org-gtd-archive.el
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ Done here is any done `org-todo-keyword'. For org-gtd this means DONE or CNCL."

(org-archive-subtree-default)))
"+LEVEL=2&+ORG_GTD=\"Projects\""
'agenda))
'agenda)

(message ".................................................")
(mapc (lambda (x) (message "---------\n %s \n-----------" x)) kill-ring)
(message ".................................................")

)

(defun org-gtd--all-subheadings-in-done-type-p ()
"Private function. Returns t if every sub-heading is in a DONE or CNCL state."
Expand Down
90 changes: 84 additions & 6 deletions org-gtd-clarify.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,100 @@
;;
;;; Code:

(require 'org-gtd-id)

(defconst org-gtd-clarify--prefix "Org-GTD WIP")

(defvar-local org-gtd-clarify--window-config nil
"Store window configuration prior to clarifying task")

(defvar-local org-gtd-clarify--stuff-marker nil
"Store marker to item that is being clarified")

(defvar-local org-gtd-clarify--clarify-id nil
"Reference to the org id of the heading currently in the WIP buffer")

(defvar-local org-gtd-clarify--inbox-p nil
"Used to separate a one-off clarify from the inbox clarification.")

;;;###autoload
(defvar org-gtd-clarify-map (make-sparse-keymap)
"Keymap for command `org-gtd-clarify-mode', a minor mode.")

;;;###autoload
(define-minor-mode org-gtd-clarify-mode
"Minor mode for org-gtd."
:lighter " GPM"
:keymap org-gtd-clarify-map
(if org-gtd-clarify-mode
(setq-local
header-line-format
(substitute-command-keys
"\\<org-gtd-clarify-map>Clarify item. Use `\\[org-gtd-organize]' to file it appropriately when finished."))
(setq-local header-line-format nil)))

;;;###autoload
(defun org-gtd-clarify-item ()
"Process item at point through org-gtd."
(interactive)
(let ((processing-buffer (org-gtd-wip--get-buffer))
(let ((processing-buffer (org-gtd-clarify--get-buffer))
(window-config (current-window-configuration))
(stuff-marker (point-marker)))
(message "Entering org-gtd-clarify-item")
(when (= (buffer-size processing-buffer) 0)
(org-copy-subtree)
(with-current-buffer processing-buffer
(org-yank)))
(message ".................................................")
(mapc (lambda (x) (message "---------\n %s \n-----------" x)) kill-ring)
(message ".................................................")

(org-paste-subtree)))
(message "stuffmarker is: %s" stuff-marker)
(with-current-buffer processing-buffer
(setq-local org-gtd-clarify--window-config window-config
org-gtd-clarify--stuff-marker stuff-marker
org-gtd-clarify--clarify-id (org-id-get)))
(set-buffer processing-buffer)
(display-buffer processing-buffer)
(delete-other-windows (get-buffer-window processing-buffer))
(setq-local org-gtd--window-config window-config
org-gtd--stuff-marker stuff-marker
org-gtd--wip-id (org-id-get)))
(delete-other-windows (get-buffer-window processing-buffer))))

;;;###autoload
(defun org-gtd-clarify-inbox-item ()
"Process item at point through org-gtd. This function is called through the
inbox clarification process."
(interactive)
(org-gtd-clarify-item)
(setq-local org-gtd-clarify--inbox-p t))

;;;###autoload
(defun org-gtd-clarify-select ()
"Prompt the user to choose one of the existing WIP buffers."
(interactive)
(let ((buf-names (mapcar #'buffer-name (org-gtd-clarify--get-buffers))))
(if buf-names
(let ((chosen-buf-name (completing-read "Choose a buffer: " buf-names)))
(get-buffer chosen-buf-name))
(message "There are no Org-GTD WIP buffers."))))

(defun org-gtd-clarify--buffer-name (id)
"Retrieve the name of the WIP buffer for this particular ID."
(format "*%s: %s*" org-gtd-clarify--prefix id))

(defun org-gtd-clarify--get-buffers ()
"Retrieve a list of Org GTD WIP buffers."
(seq-filter (lambda (buf)
(string-match-p org-gtd-clarify--prefix (buffer-name buf)))
(buffer-list)))

(defun org-gtd-clarify--get-buffer ()
"Get or create a WIP buffer for heading at point."
(org-gtd-id-get-create)
(let ((buffer (get-buffer-create (org-gtd-clarify--buffer-name (org-id-get)))))
(with-current-buffer buffer
(let ((org-todo-keywords '((sequence "NEXT" "TODO" "WAIT" "|" "DONE" "CNCL" "TRASH"))))
(org-mode)
(org-gtd-clarify-mode 1))
buffer)))

(provide 'org-gtd-clarify)
;;; org-gtd-clarify.el ends here
Loading

0 comments on commit 09344fd

Please sign in to comment.