[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/beancount dbafe6a73d 082/103: Shift beancount-insert-date
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/beancount dbafe6a73d 082/103: Shift beancount-insert-date by DAYS from today using prefix args |
Date: |
Mon, 29 Apr 2024 15:59:48 -0400 (EDT) |
branch: elpa/beancount
commit dbafe6a73d90c1f64d457b356b9dbb43499f70d5
Author: Debanjum Singh Solanky <debanjum@gmail.com>
Commit: Martin Blais <blais@furius.ca>
Shift beancount-insert-date by DAYS from today using prefix args
Examples
- ~C-u -1 M-x beancount-insert-date~ return yesterdays date
- ~C-u 7 M-x beancount-insert-date~ returns date a week from today
---
beancount.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/beancount.el b/beancount.el
index fa49eb94b5..292dda5848 100644
--- a/beancount.el
+++ b/beancount.el
@@ -815,11 +815,18 @@ what that column is and returns it (an integer)."
(goto-char pos)
(insert " " currency))))))))
-(defun beancount-insert-date ()
- "Start a new timestamped directive."
- (interactive)
+(defun beancount-insert-date (&optional days)
+ "Start a new timestamped directive with date shifted by DAYS from today."
+ (interactive "P")
(unless (bolp) (newline))
- (insert (format-time-string "%Y-%m-%d") " "))
+ (insert (beancount--shift-current-date days) " "))
+
+(defun beancount--shift-current-date (days)
+ "Return ISO-8601 formatted date shifted by DAYS from today."
+ (let ((days-to-shift (or days 0)))
+ (format-time-string
+ "%Y-%m-%d"
+ (time-add (current-time) (days-to-time days-to-shift)))))
(defvar beancount-install-dir nil
"Directory in which Beancount's source is located.
- [nongnu] elpa/beancount 7410724924 065/103: beancount-region: Added bindings for region_value variant., (continued)
- [nongnu] elpa/beancount 7410724924 065/103: beancount-region: Added bindings for region_value variant., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 9508e5640c 060/103: Add README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 3c04745fa5 069/103: Add missing paren to configuration example in README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dcb317ed0a 064/103: If the cursor is over a link, invoke 'bean-doctor linked' command with the link, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 5ff509075d 063/103: Fixes to /etc, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7785e8803f 067/103: Improve thing-at-point definition for beancount-link, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 194a9e9697 061/103: Added license., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 90c3992269 076/103: Fix imenu tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 5be04a37d6 081/103: (Merge branch 'main' into cost), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7b8f02ebcd 077/103: Cleanup faces definitions, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dbafe6a73d 082/103: Shift beancount-insert-date by DAYS from today using prefix args,
ELPA Syncer <=
- [nongnu] elpa/beancount e32e44e8d2 092/103: Added personal binding to aggregate balance binding., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 73b2afcff6 087/103: (Merge remote-tracking branch 'github/main'), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 42edc5bf07 083/103: Align amounts in balance directives in the same way as in postings, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 41039a8d7b 085/103: Added support for accounts in thing-at-point., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 3725c02702 103/103: Update account name regex to allow starting with a number, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 77027e2cf8 037/103: beancount.el: Add outline-minor-mode integration tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 83cd9330e3 050/103: beancount.el: Include underscore and dash to metadata regexp., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 8091f35803 056/103: beancount.el: Add beancount-electric-currency, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 449212459e 072/103: fix parenthses mismatch on beancount outline 1-8, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount d560451fda 071/103: Use beancount-level-N faces instead of org-level-N, ELPA Syncer, 2024/04/29