-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaph-org-agenda.el
executable file
·81 lines (61 loc) · 2.86 KB
/
aph-org-agenda.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; aph-org-agenda.el --- Extensions for Org agenda -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Aaron Harris
;; Author: Aaron Harris <meerwolf@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
;; Dependencies: `org-agenda'
;; This program 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 of the License, or
;; (at your option) any later version.
;; This program 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 program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Commands extending the functionality of the Org-mode agenda.
;;; Code:
(require 'org-agenda)
(require 'aph-org)
;;;; Indentation Fixes
;;====================
(put 'org-agenda-with-point-at-orig-entry 'lisp-indent-function 1)
;;;; Timestamps
;;=============
(defun aph/org-agenda-date-later (arg)
"As `org-agenda-date-later' but also work in TODO agendas.
Unlike `org-agenda-date-later', there is some question of which
timestamp to use. If the entry contains a timestamp for today's
date, that timestamp is changed; otherwise, the first active
timestamp in the entry is changed.
Unlike `org-agenda-date-later', this command does not support
changing timestamps by increments other than days."
;; TODO: Make this undoable.
(interactive "p")
(if (org-agenda-check-type nil 'agenda 'timeline)
(org-agenda-date-later arg)
(let ((marker (or (org-get-at-bol 'org-marker)
(org-agenda-error)))
stamp)
(org-agenda-with-point-at-orig-entry nil
;; First try today's date, then find any active timestamp.
(unless (or (aph/org-find-timestamp nil 'active
(aph/org-relative-timestamp))
(aph/org-find-timestamp nil 'active))
(error "Could not find a timestamp to change"))
(org-timestamp-up-day arg)
(setq stamp (aph/org-timestamp-at-point)))
(org-agenda-show-new-time marker stamp))))
(defun aph/org-agenda-date-earlier (arg)
"As `org-agenda-date-earlier' but also work in TODO agendas.
Unlike `org-agenda-date-earlier', there is some question of which
timestamp to use. If the entry contains a timestamp for today's
date, that timestamp is changed; otherwise, the first active
timestamp in the entry is changed.
Unlike `org-agenda-date-earlier', this command does not support
changing timestamps by increments other than days."
(interactive "p")
(aph/org-agenda-date-later (- arg)))
(provide 'aph-org-agenda)
;;; aph-org-agenda.el ends here