summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-12-31 12:31:13 -0500
committerKyle Meyer <kyle@kyleam.com>2022-11-26 21:45:14 -0500
commit600a79b6409f73a4a46b685672c00c375c525ac5 (patch)
tree1c774c17cc574516cd69e9bfa45a69b61e21851e
parent6afa7d75e4f5f4c7008216664cdbc3532fb88085 (diff)
downloademacs.d-600a79b6409f73a4a46b685672c00c375c525ac5.tar.gz
ledger-mode: Add account/payee insertion commands
I think this was to deal with fallout from updating to v4, but that was a while ago, and I didn't record details at the time. In any case, I use these commands regularly now.
-rw-r--r--init.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/init.el b/init.el
index 09d6207..26ab849 100644
--- a/init.el
+++ b/init.el
@@ -91,6 +91,7 @@
(define-prefix-command 'km/dired-prefix-map)
(define-prefix-command 'km/dired-subtree-prefix-map)
(define-prefix-command 'km/gnus-summary-prefix-map)
+(define-prefix-command 'km/ledger-prefix-map)
(define-prefix-command 'km/magit-map)
(define-prefix-command 'km/magit-wip-map)
(define-prefix-command 'km/org-prefix-map)
@@ -1736,7 +1737,22 @@
(add-to-list 'font-lock-global-modes 'ledger-mode t))
(`(,_ . ,_)
(setq font-lock-global-modes
- (delq 'ledger-mode font-lock-global-modes))))))
+ (delq 'ledger-mode font-lock-global-modes)))))
+
+ (bind-keys :map km/ledger-prefix-map
+ ("a" . km/ledger-insert-account)
+ ("p" . km/ledger-insert-payee))
+ :config
+ (defun km/ledger-insert-account ()
+ (interactive)
+ (insert (completing-read "Account: " (ledger-accounts-list))))
+
+ (defun km/ledger-insert-payee ()
+ (interactive)
+ (insert (completing-read "Payee: " (ledger-payees-in-buffer))))
+
+ (bind-keys :map ledger-mode-map
+ ("C-c m" . km/ledger-prefix-map)))
(use-package rst
:defer t