forked from Trevoke/org-gtd.el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
org-gtd-trash.el
50 lines (40 loc) · 1.6 KB
/
org-gtd-trash.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;; org-gtd-trash.el --- Define trash items in org-gtd -*- lexical-binding: t; coding: utf-8 -*-
;;
;; Copyright © 2019-2023 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:
;;
;; Trash items have their own logic, defined here.
;;
;;; Code:
(defcustom org-gtd-organize-trash-func
#'org-gtd-trash--apply
"Function called when item at point is to be discarded."
:group 'org-gtd-organize
:type 'function
:package-version '(org-gtd . "3.0.0"))
;;;###autoload
(defun org-gtd-trash--one-off ()
(interactive)
(org-gtd-organize--call org-gtd-organize-trash-func))
;;;###autoload
(defun org-gtd-trash--inbox-loop ()
(interactive)
(org-gtd-organize-inbox-item org-gtd-organize-trash-func))
(defun org-gtd-trash--apply ()
"Mark GTD inbox item as cancelled and move it to the org-gtd task archives."
(org-todo org-gtd-canceled)
(with-org-gtd-context (org-archive-subtree)))
(provide 'org-gtd-trash)
;;; org-gtd-trash.el ends here