Skip to content

Commit

Permalink
try to be friendlier to straight.el
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevoke committed Dec 28, 2021
1 parent abf43ae commit 8b00cc5
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 51 deletions.
4 changes: 2 additions & 2 deletions dev/.emacs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

(use-package org-gtd
:after org
:quelpa ((org-gtd :fetcher github :repo "trevoke/org-gtd.el"
:branch "2.0.0") :upgrade t)
:quelpa ((org-gtd :fetcher github :repo "trevoke/org-gtd.el")
:upgrade t)
:demand t
:custom
(org-agenda-property-position 'next-line)
Expand Down
1 change: 1 addition & 0 deletions org-gtd-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

(require 'winner)
(require 'org-agenda)
(require 'org-gtd-core)

(defconst org-gtd-stuck-projects
'("+LEVEL=2&+ORG_GTD=\"Projects\"" ("NEXT" "WAIT") nil "")
Expand Down
1 change: 1 addition & 0 deletions org-gtd-capture.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
;;; Code:

(require 'org-capture)
(require 'org-gtd-core)

;;;###autoload
(defun org-gtd-capture (&optional goto keys)
Expand Down
63 changes: 63 additions & 0 deletions org-gtd-core.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
;;; org-gtd-core.el --- Core code for org-gtd -*- lexical-binding: t; coding: utf-8 -*-
;;
;; Copyright © 2019-2021 Aldric Giacomoni

;; Author: Aldric Giacomoni <[email protected]>
;; This file is not part of GNU Emacs.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this file. If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; Core logic for org-gtd
;; Creating this file because straight.el seems unhappy.
;;
;;; Code:

(defconst org-gtd-inbox "inbox")
(defconst org-gtd-incubated "incubated")
(defconst org-gtd-projects "projects")
(defconst org-gtd-actions "actions")
(defconst org-gtd-delegated "delegated")
(defconst org-gtd-calendar "calendar")

(defconst org-gtd--properties
(let ((myhash (make-hash-table :test 'equal)))
(puthash org-gtd-actions "Actions" myhash)
(puthash org-gtd-incubated "Incubated" myhash)
(puthash org-gtd-projects "Projects" myhash)
(puthash org-gtd-calendar "Calendar" myhash)
myhash))

;;;###autoload
(defmacro with-org-gtd-context (&rest body)
"Wrap any BODY in this macro to inherit the org-gtd settings for your logic."
(declare (debug t) (indent 2))
`(let* ((org-use-property-inheritance "ORG_GTD")
(org-archive-location (funcall org-gtd-archive-location))
(org-capture-templates (seq-concatenate
'list
(org-gtd--capture-templates)
org-capture-templates))
(org-refile-use-outline-path nil)
(org-stuck-projects org-gtd-stuck-projects)
(org-odd-levels-only nil)
(org-agenda-files `(,org-gtd-directory))
(org-agenda-property-list '("DELEGATED_TO"))
(org-agenda-custom-commands org-gtd-agenda-custom-commands))
(unwind-protect
(progn ,@body))))

(provide 'org-gtd-core)
;;; org-gtd-core.el ends here
43 changes: 43 additions & 0 deletions org-gtd-delegate.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
;;; org-gtd-delegate.el --- logic to delegate items -*- lexical-binding: t; coding: utf-8 -*-
;;
;; Copyright © 2019-2021 Aldric Giacomoni

;; Author: Aldric Giacomoni <[email protected]>
;; This file is not part of GNU Emacs.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this file. If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; Item delegation logic for Org GTD.
;;
;;; Code:

(require 'org)

;;;###autoload
(defun org-gtd-delegate ()
"Delegate item at point."
(interactive)
(let ((delegated-to (read-string "Who will do this? "))
(org-inhibit-logging 'note))
(org-set-property "DELEGATED_TO" delegated-to)
(org-todo "WAIT")
(org-schedule 0)
(save-excursion
(goto-char (org-log-beginning t))
(insert (format "programmatically delegated to %s\n" delegated-to)))))

(provide 'org-gtd-delegate)
;;; org-gtd-delegate.el ends here
1 change: 1 addition & 0 deletions org-gtd-inbox-processing.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
;;; Code:

(require 'transient)
(require 'org-gtd-core)

;;;###autoload
(defvar org-gtd-process-map (make-sparse-keymap)
Expand Down
2 changes: 2 additions & 0 deletions org-gtd-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
;;; Code:

(require 'org-agenda)
(require 'org-edna)
(require 'org-gtd-core)

(defvar org-gtd-edna-inheritance nil "Private.")
(defvar org-gtd-edna nil "Private.")
Expand Down
5 changes: 5 additions & 0 deletions org-gtd-projects.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
;;
;;; Code:

(require 'org)
(require 'org-element)
(require 'org-edna)
(require 'org-gtd-core)

;;;###autoload
(defun org-gtd-cancel-project ()
"With point on topmost project heading, mark all undone tasks canceled."
Expand Down
5 changes: 5 additions & 0 deletions org-gtd-refile.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
;;
;;; Code:

(require 'org)
(require 'org-refile)
(require 'org-element)
(require 'org-gtd-core)

(defconst org-gtd-projects-template
"* Projects
:PROPERTIES:
Expand Down
51 changes: 2 additions & 49 deletions org-gtd.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
;;
;;; Code:

;;;; Requirements

(require 'subr-x)
(require 'cl-lib)
(require 'f)
Expand All @@ -52,40 +50,8 @@
(require 'org-edna)
(require 'org-gtd-customize)

(defconst org-gtd-inbox "inbox")
(defconst org-gtd-incubated "incubated")
(defconst org-gtd-projects "projects")
(defconst org-gtd-actions "actions")
(defconst org-gtd-delegated "delegated")
(defconst org-gtd-calendar "calendar")

(defconst org-gtd--properties
(let ((myhash (make-hash-table :test 'equal)))
(puthash org-gtd-actions "Actions" myhash)
(puthash org-gtd-incubated "Incubated" myhash)
(puthash org-gtd-projects "Projects" myhash)
(puthash org-gtd-calendar "Calendar" myhash)
myhash))

;;;###autoload
(defmacro with-org-gtd-context (&rest body)
"Wrap any BODY in this macro to inherit the org-gtd settings for your logic."
(declare (debug t) (indent 2))
`(let* ((org-use-property-inheritance "ORG_GTD")
(org-archive-location (funcall org-gtd-archive-location))
(org-capture-templates (seq-concatenate
'list
(org-gtd--capture-templates)
org-capture-templates))
(org-refile-use-outline-path nil)
(org-stuck-projects org-gtd-stuck-projects)
(org-odd-levels-only nil)
(org-agenda-files `(,org-gtd-directory))
(org-agenda-property-list '("DELEGATED_TO"))
(org-agenda-custom-commands org-gtd-agenda-custom-commands))
(unwind-protect
(progn ,@body))))

(require 'org-gtd-core)
(require 'org-gtd-delegate)
(require 'org-gtd-archive)
(require 'org-gtd-capture)
(require 'org-gtd-files)
Expand All @@ -95,18 +61,5 @@
(require 'org-gtd-inbox-processing)
(require 'org-gtd-mode)

;;;###autoload
(defun org-gtd-delegate ()
"Delegate item at point."
(interactive)
(let ((delegated-to (read-string "Who will do this? "))
(org-inhibit-logging 'note))
(org-set-property "DELEGATED_TO" delegated-to)
(org-todo "WAIT")
(org-schedule 0)
(save-excursion
(goto-char (org-log-beginning t))
(insert (format "programmatically delegated to %s\n" delegated-to)))))

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

0 comments on commit 8b00cc5

Please sign in to comment.