summaryrefslogtreecommitdiff
path: root/ledger.el
diff options
context:
space:
mode:
Diffstat (limited to 'ledger.el')
-rw-r--r--ledger.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/ledger.el b/ledger.el
new file mode 100644
index 00000000..42be85a6
--- /dev/null
+++ b/ledger.el
@@ -0,0 +1,16 @@
+(defun ledger-add-entry (entry)
+ (interactive
+ (list (read-string "Entry: "
+ (format-time-string "%m.%d " (current-time)))))
+ (let ((args (mapcar 'shell-quote-argument (split-string entry))))
+ (shell-command
+ (concat "ledger entry "
+ (mapconcat 'identity args " ")) t)
+ (delete-char 5)
+ (exchange-point-and-mark)))
+
+(define-derived-mode ledger-mode text-mode "Ledger"
+ "A mode for editing ledger data files."
+ (setq comment-start ";" comment-end nil)
+ (let ((map (current-local-map)))
+ (define-key map [(control ?c) ?n] 'ledger-add-entry)))