forked from alphapapa/org-ql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
org-bills-due.el
53 lines (43 loc) · 1.41 KB
/
org-bills-due.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
;;; org-bills-due.el
;;;; Initialize package system
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; Set load-path, loading org-ql from ~/src/emacs/org-ql (adjust as necessary)
(setq load-path (append (list "~/src/emacs/org-ql"
"~/.emacs.d/load-path")
load-path))
;;;; Load packages
;; Built-in
(require 'cl-lib)
(require 'subr-x)
(require 'org)
(require 'org-habit)
(require 'org-agenda)
;; From MELPA
(require 'dash)
(require 's)
;; org-ql
(require 'org-ql)
(require 'org-ql-agenda)
;;;; Main
(-if-let* ((header "Bills due within 3 days")
(items (org-ql "~/org/main.org"
(and (deadline 3)
(tags "bills"))
:action (org-get-heading 'no-tags 'no-todo)))
(string (concat "<ul>"
(s-join ""
(--map (concat "<li>" it "</li>")
items))
"</ul>")))
(progn
;; Send notification
(call-process "notify-send" nil 0 nil
(format "<b>%s</b>" header)
string)
;; Also output to STDOUT
(princ (format "%s:\n%s" header (s-join "\n" titles))))
;; No bills due
(kill-emacs 1))