Skip to content

Commit

Permalink
make the organizing functions constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevoke committed May 8, 2023
1 parent 5257e65 commit 6b338bd
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 98 deletions.
10 changes: 7 additions & 3 deletions org-gtd-archive.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
(require 'org-gtd-core)
(require 'org-gtd-agenda)

(defcustom org-gtd-archive-location
#'org-gtd-archive-location-func
(defgroup org-gtd-archive nil
"How to archive completed / canceled items."
:package-version '(org-gtd . "3.0.0")
:group 'org-gtd)

(defcustom org-gtd-archive-location #'org-gtd-archive-location-func
"Function to generate archive location for org gtd.
That is to say, when items get cleaned up from the active files, they will go
Expand All @@ -44,7 +48,7 @@ org-gtd's archive behavior.
This function has an arity of zero. By default this generates a file
called gtd_archive_<currentyear> in `org-gtd-directory' and puts the entries
into a datetree."
:group 'org-gtd
:group 'org-gtd-archive
:type 'sexp
:package-version '(org-gtd . "2.0.0"))

Expand Down
3 changes: 2 additions & 1 deletion org-gtd-areas-of-focus.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
(require 'org)

(require 'org-gtd-core)
(require 'org-gtd-horizons)
(require 'org-gtd-organize)

(defcustom org-gtd-areas-of-focus '("Home" "Health" "Family" "Career")
"The current major areas in your life where you don't want to drop balls."
:type 'list
:group 'org-gtd
:group 'org-gtd-horizons
:package-version '(org-gtd . "3.0.0"))

(defun org-gtd-areas-of-focus--set ()
Expand Down
20 changes: 11 additions & 9 deletions org-gtd-autoloads.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This assumes all GTD files are also agenda files." t nil)
(autoload 'org-gtd-engage-grouped-by-context "org-gtd-agenda" "\
Show all `org-gtd-next' actions grouped by context (tag prefixed with @)." t nil)

(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gtd-agenda" '("org-gtd-agenda-")))
(register-definition-prefixes "org-gtd-agenda" '("org-gtd-agenda-"))

;;;***

Expand Down Expand Up @@ -149,7 +149,7 @@ Delegate item at point on agenda view." t nil)

(function-put 'org-gtd-delegate-agenda-item 'command-modes '(org-agenda-mode))

(register-definition-prefixes "org-gtd-delegate" '("org-gtd-"))
(register-definition-prefixes "org-gtd-delegate" '("org-gtd-delegate"))

;;;***

Expand Down Expand Up @@ -186,7 +186,7 @@ Delegate item at point on agenda view." t nil)
;;;;;; 0 0 0))
;;; Generated autoloads from org-gtd-incubate.el

(register-definition-prefixes "org-gtd-incubate" '("org-gtd-"))
(register-definition-prefixes "org-gtd-incubate" '("org-gtd-incubate"))

;;;***

Expand Down Expand Up @@ -270,15 +270,17 @@ With point on topmost project heading, mark all undone tasks canceled." t nil)
(autoload 'org-gtd-project-cancel-from-agenda "org-gtd-projects" "\
Cancel the project that has the highlighted task." t nil)

(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gtd-projects" '("org-")))
(function-put 'org-gtd-project-cancel-from-agenda 'command-modes '(org-agenda-mode))

(register-definition-prefixes "org-gtd-projects" '("org-"))

;;;***

;;;### (autoloads nil "org-gtd-quick-action" "org-gtd-quick-action.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from org-gtd-quick-action.el

(register-definition-prefixes "org-gtd-quick-action" '("org-gtd-"))
(register-definition-prefixes "org-gtd-quick-action" '("org-gtd-quick-action"))

;;;***

Expand All @@ -295,7 +297,7 @@ TYPE is the org-gtd action type. BODY is the rest of the code.

(function-put 'with-org-gtd-refile 'lisp-indent-function '1)

(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gtd-refile" '("org-gtd-")))
(register-definition-prefixes "org-gtd-refile" '("org-gtd-refile-"))

;;;***

Expand All @@ -316,7 +318,7 @@ mostly of value for testing purposes.
(autoload 'org-gtd-review-stuck-projects "org-gtd-review" "\
Show all projects that do not have a next action." t nil)

(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gtd-review" '("org-gtd-review-stuck-")))
(register-definition-prefixes "org-gtd-review" '("org-gtd-review-stuck-"))

;;;***

Expand All @@ -338,15 +340,15 @@ Show all projects that do not have a next action." t nil)
;;;### (autoloads nil "org-gtd-trash" "org-gtd-trash.el" (0 0 0 0))
;;; Generated autoloads from org-gtd-trash.el

(register-definition-prefixes "org-gtd-trash" '("org-gtd-"))
(register-definition-prefixes "org-gtd-trash" '("org-gtd-trash"))

;;;***

;;;### (autoloads nil "org-gtd-upgrades" "org-gtd-upgrades.el" (0
;;;;;; 0 0 0))
;;; Generated autoloads from org-gtd-upgrades.el

(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-gtd-upgrades" '("org-gtd-upgrade")))
(register-definition-prefixes "org-gtd-upgrades" '("org-gtd-upgrade"))

;;;***

Expand Down
12 changes: 6 additions & 6 deletions org-gtd-calendar.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
:END:
" org-gtd-calendar))

(defcustom org-gtd-calendar-func
#'org-gtd-calendar--apply
(defconst org-gtd-calendar-func #'org-gtd-calendar--apply
"Function called when item at point is a task that must happen on a given day.
Keep this clean and don't load your calendar with things that aren't
actually appointments or deadlines."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defun org-gtd-calendar (&optional appointment-date)
"Decorate and refile item at point as a calendar item.
Expand All @@ -73,7 +73,7 @@ non-interactively."
(insert (format "<%s>" date))))
(setq-local org-gtd--organize-type 'calendar)
(org-gtd-organize-apply-hooks)
(org-gtd--refile org-gtd-calendar org-gtd-calendar-template))
(org-gtd-refile--do org-gtd-calendar org-gtd-calendar-template))

(defun org-gtd-calendar-create (topic appointment-date)
"Automatically create a calendar task in the GTD flow.
Expand Down
7 changes: 6 additions & 1 deletion org-gtd-capture.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ This is the inbox. Everything goes in here when you capture it.
"
"Template for the GTD inbox.")

(defgroup org-gtd-capture nil
"Manage the functions for organizing the GTD actions."
:package-version '(org-gtd . "3.0.0")
:group 'org-gtd)

(defcustom org-gtd-capture-templates
`(("i" "Inbox"
entry (file ,#'org-gtd-inbox-path)
Expand All @@ -51,7 +56,7 @@ This is the inbox. Everything goes in here when you capture it.
See `org-capture-templates' for the format of each capture template.
Make the sure the template string starts with a single asterisk to denote a
top level heading, or the behavior of org-gtd will be undefined."
:group 'org-gtd
:group 'org-gtd-capture
:type 'sexp
:package-version '(org-gtd . "2.0.0"))

Expand Down
18 changes: 9 additions & 9 deletions org-gtd-delegate.el
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
"Function that is called to read in the Person the task is delegated to.
Needs to return a string that will be used as the persons name."
:group 'org-gtd
:group 'org-gtd-organize
:package-version '(org-gtd . "2.3.0")
:type 'function )

(defcustom org-gtd-organize-delegate-func
#'org-gtd-delegate--apply
"Function called when item at at point is an action delegated to someone else."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
(defconst org-gtd-delegate-func #'org-gtd-delegate--apply
"Function called when organizing item at at point as delegated."
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defun org-gtd-delegate (&optional delegated-to checkin-date)
"Organize and refile item at point as a delegated item.
Expand All @@ -60,7 +60,7 @@ and CHECKIN-DATE as the YYYY-MM-DD string of when you want `org-gtd' to remind
you if you want to call this non-interactively."
(interactive)
(org-gtd-organize--call
(apply-partially org-gtd-organize-delegate-func
(apply-partially org-gtd-delegate-func
delegated-to
checkin-date)))

Expand All @@ -73,7 +73,7 @@ you if you want to call this non-interactively."
(org-gtd-delegate-item-at-point delegated-to checkin-date)
(setq-local org-gtd--organize-type 'delegated)
(org-gtd-organize-apply-hooks)
(org-gtd--refile org-gtd-action org-gtd-action-template))
(org-gtd-refile--do org-gtd-action org-gtd-action-template))

;;;###autoload
(defun org-gtd-delegate-item-at-point (&optional delegated-to checkin-date)
Expand Down
14 changes: 7 additions & 7 deletions org-gtd-habit.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
:END:
" org-gtd-habit))

(defcustom org-gtd-habit-func
#'org-gtd-habit--apply
"Function called when item at point is a habit."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
(defconst org-gtd-habit-func #'org-gtd-habit--apply
"Function called when organizing item as a habit."
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defun org-gtd-habit (&optional repeater)
"Organize and refile item at point as a calendar item.
Expand All @@ -71,7 +71,7 @@ determine how often you'll be reminded of this habit."
(org-entry-put (point) "STYLE" "habit"))
(setq-local org-gtd--organize-type 'habit)
(org-gtd-organize-apply-hooks)
(org-gtd--refile org-gtd-habit org-gtd-habit-template))
(org-gtd-refile--do org-gtd-habit org-gtd-habit-template))

(defun org-gtd-habit-create (topic repeater)
"Automatically create a habit in the GTD flow.
Expand Down
7 changes: 6 additions & 1 deletion org-gtd-horizons.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@

(require 'org-gtd-files)

(defgroup org-gtd-horizons nil
"Variables handling GTD horizons-related logic."
:package-version '(org-gtd . "3.0.0")
:group 'org-gtd)

(defcustom org-gtd-horizons-file "horizons.org"
"File holding your GTD horizons.
This may get displayed during item clarification for context and focus.
This file must be in the `org-gtd-directory'."
:group 'org-gtd
:group 'org-gtd-horizons
:package-version '(org-gtd . "3.0")
:type 'file)

Expand Down
16 changes: 8 additions & 8 deletions org-gtd-incubate.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
" org-gtd-incubate)
"Template for the GTD someday/maybe list.")

(defcustom org-gtd-organize-incubate-func
#'org-gtd-incubate--apply
"Function called when item at point is to be incubated."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
(defconst org-gtd-incubate-func #'org-gtd-incubate--apply
"Function called when organizing item as incubated."
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defun org-gtd-incubate (&optional reminder-date)
"Decorate, organize and refile item at point as incubated.
Expand All @@ -54,7 +54,7 @@ If you want to call this non-interactively,
REMINDER-DATE is the YYYY-MM-DD string for when you want this to come up again."
(interactive)
(org-gtd-organize--call
(apply-partially org-gtd-organize-incubate-func
(apply-partially org-gtd-incubate-func
reminder-date)))

(defun org-gtd-incubate--apply (&optional reminder-date)
Expand All @@ -71,7 +71,7 @@ REMINDER-DATE is the YYYY-MM-DD string for when you want this to come up again."
(insert (format "<%s>" date))))
(setq-local org-gtd--organize-type 'incubated)
(org-gtd-organize-apply-hooks)
(org-gtd--refile org-gtd-incubate org-gtd-incubate-template))
(org-gtd-refile--do org-gtd-incubate org-gtd-incubate-template))

(defun org-gtd-incubate-create (topic reminder-date)
"Automatically create a delegated task in the GTD flow.
Expand Down
10 changes: 5 additions & 5 deletions org-gtd-knowledge.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
(declare-function 'org-gtd-organize--call 'org-gtd-organize)
(declare-function 'org-gtd-organize-apply-hooks 'org-gtd-organize)

(defcustom org-gtd-knowledge-func
#'org-gtd-knowledge--apply
(defconst org-gtd-knowledge-func #'org-gtd-knowledge--apply
"Function called when item at point is knowledge to be stored.
Note that this function is used inside loops,for instance to process the inbox,
so if you have manual steps you need to take when storing a heading
as knowledge, take them before calling this function
\(for instance, during inbox processing, take the manual steps during the
clarify step, before you call `org-gtd-organize')."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defun org-gtd-knowledge ()
"Decorate, organize and refile item at point as knowledge."
Expand Down
2 changes: 1 addition & 1 deletion org-gtd-organize.el
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ the items once they have been processed and add them to that list.
Once you have your ground items managed, you might like to set the variable
`org-gtd-areas-of-focus' and add `org-gtd-set-area-of-focus' to these hooks."
:group 'org-gtd
:group 'org-gtd-organize
:package-version '(org-gtd . "1.0.4")
:type 'hook
:options '(org-set-tags-command org-set-effort org-priority))
Expand Down
35 changes: 16 additions & 19 deletions org-gtd-projects.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,19 @@
(declare-function 'org-gtd-organize--call 'org-gtd-organize)
(declare-function 'org-gtd-organize-apply-hooks 'org-gtd-organize)

(defcustom org-gtd-organize-project-func
#'org-gtd-project-new--apply
"Function called when item at point is a project.
You *probably* should not change this from the default, as a lot of fiddly bits
depend on the way org-gtd structures and organizes the projects."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))

(defcustom org-gtd-organize-add-to-project-func
#'org-gtd-project-extend--apply
"Function called when item at point is a new task in an existing project."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
(defconst org-gtd-project-func #'org-gtd-project-new--apply
"Function called when organizing item at point as a project."
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defconst org-gtd-add-to-project-func #'org-gtd-project-extend--apply
"Function called when organizing item at point as a new task in a project."
;; :group 'org-gtd-organize
;; :type 'function
;; :package-version '(org-gtd . "3.0.0")
)

(defconst org-gtd-project-headings
"+LEVEL=2&+ORG_GTD=\"Projects\""
Expand Down Expand Up @@ -126,12 +123,12 @@ instead.")
(defun org-gtd-project-new ()
"Organize, decorate and refile item as a new project."
(interactive)
(org-gtd-organize--call org-gtd-organize-project-func))
(org-gtd-organize--call org-gtd-project-func))

(defun org-gtd-project-extend ()
"Organize, decorate and refile item as a new task in an existing project."
(interactive)
(org-gtd-organize--call org-gtd-organize-add-to-project-func))
(org-gtd-organize--call org-gtd-add-to-project-func))

(defun org-gtd-project-new--apply ()
"Process GTD inbox item by transforming it into a project.
Expand All @@ -155,7 +152,7 @@ Refile to `org-gtd-actionable-file-basename'."
(org-end-of-line))
(insert " [/]")
(org-update-statistics-cookies t)
(org-gtd--refile org-gtd-projects org-gtd-projects-template))
(org-gtd-refile--do org-gtd-projects org-gtd-projects-template))

(defun org-gtd-project-extend--apply ()
"Refile the org heading at point under a chosen heading in the agenda files."
Expand Down
Loading

0 comments on commit 6b338bd

Please sign in to comment.