From 2d11e40507de8dac0c63a7a7c69aa545e27a1e36 Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Mon, 27 Sep 2021 08:03:58 -0500 Subject: [PATCH] Rent template --- lisp/org-config/my-org-capture-templates.el | 14 ++++++++++- lisp/org-config/my-rent-capture-template.el | 28 +++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 lisp/org-config/my-rent-capture-template.el diff --git a/lisp/org-config/my-org-capture-templates.el b/lisp/org-config/my-org-capture-templates.el index 6244fd7..6119e10 100644 --- a/lisp/org-config/my-org-capture-templates.el +++ b/lisp/org-config/my-org-capture-templates.el @@ -118,6 +118,13 @@ (find-file (my/org-file (format "journals/%s" journal))) (outline-next-heading))) +(defun my/rent-next-month () + (if (<= 15 (ts-day (ts-now))) + (format-time-string "%B" + (time-convert (time-add (current-time) + (days-to-time 16)))) + (format-time-string "%B"))) + (setq org-capture-templates (doct `(("Tasks" :keys "t" :children (("New Refile Task" @@ -172,7 +179,12 @@ ("Reconciliation" :keys "r" :file ,(my/org-file "entries/reviews.gpg") :olp ("Reviews") - :template-file ,(my/org-file "templates/fin-recon.org")))) + :template-file ,(my/org-file "templates/fin-recon.org")) + ("Rent" :keys "R" + :unnarrowed t :empty-lines 1 :type plain + :function (lambda () (org-capture-put :month-rent (my/rent-next-month)) (end-of-buffer)) + :file ,(my/plaintext-file "ledger-finance/ledger.ledger") + :template-file ,(my/org-file "templates/rent.ledger")))) ("Record Comms Message" :file ,(my/agenda-file "datetree.org") :keys "C" diff --git a/lisp/org-config/my-rent-capture-template.el b/lisp/org-config/my-rent-capture-template.el new file mode 100644 index 0000000..1b1abf0 --- /dev/null +++ b/lisp/org-config/my-rent-capture-template.el @@ -0,0 +1,28 @@ +;;; my-rent-capture-template.el --- -*- lexical-binding: t -*- + +;; Copyright (C) 2021 Benson Chu + +;; Author: Benson Chu +;; Created: [2021-09-26 17:35] + +;; This file is not part of GNU Emacs + +;; 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 . + +;;; Commentary: + +;;; Code: + +(provide 'my-rent-capture-template) +;;; my-rent-capture-template.el ends here