Skip to content

Commit

Permalink
feat: allow to customize function to read in name of delegated person
Browse files Browse the repository at this point in the history
  • Loading branch information
DerBeutlin committed Feb 18, 2023
1 parent 09601da commit 8bc8f56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/org-gtd.org
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Make sure you also read about sub-package configuration: [[*Required configurati
- ~org-gtd-process-item-hooks~ :: this is a list of functions that you can use to decorate each item when you clarify it. For instance, you could add a function to set the effort, or the priority, or some category, etc. By default it has only one function, which lets you add tags. You could remove this function if you wanted. [[*Processing the inbox]].
- ~org-gtd-archive-location~ :: variable that holds a function to generate the archive file. I made this choice primarily because I want to refile to an archive file suffixed with the year, and I'm *just too lazy* to manually rename them once a year. The function has an arity of zero and generates an org-mode file+outline path. [[*Cleaning up / archiving completed work]].
- ~org-gtd-refile-to-any-target~ :: when ~t~, =org-gtd= will refile to the first target it finds, and create a target if it doesn't find one. When false, it will ask for confirmation before refiling. [[*Multiple files / refile targets]].
- ::
- ~org-gtd-delegate-read-func~ :: function that is used to prompt for a person a task is delegated to. Must return a string. By default this is set to ~read-string~.
*** Recommended key bindings

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.
Expand Down
8 changes: 8 additions & 0 deletions org-gtd-customize.el
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,13 @@ the string."
(category (concat (substring (string-pad category 11) 0 10) ""))
"Simple task")))

(defcustom org-gtd-delegate-read-func (lambda () (read-string "Who will do this? "))
"Function that is called to read in the Person the task is delegated to.
Needs to return a string thet will be used as the persons name."
:group 'org-gtd
:package-version '(org-gtd . "2.0.0")
:type 'function )

(provide 'org-gtd-customize)
;;; org-gtd-customize.el ends here
3 changes: 2 additions & 1 deletion org-gtd-delegate.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
;;; Code:

(require 'org)
(require 'org-gtd-customize)

;;;###autoload
(defun org-gtd-delegate ()
"Delegate item at point."
(interactive)
(let ((delegated-to (read-string "Who will do this? "))
(let ((delegated-to (apply org-gtd-delegate-read-func nil))
(org-inhibit-logging 'note))
(org-set-property "DELEGATED_TO" delegated-to)
(org-todo "WAIT")
Expand Down

0 comments on commit 8bc8f56

Please sign in to comment.