branch: elpa/beancount commit 0cd55a8038f4345a073648402471e8c044b72674 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
beancount.el: Introduce beancount-insert-date and bind it to M-RET It inserts the date part of a new transaction or other directive. --- beancount.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/beancount.el b/beancount.el index 1f8edec48d..4a9a53c477 100644 --- a/beancount.el +++ b/beancount.el @@ -269,6 +269,7 @@ to align all amounts." (let ((map (make-sparse-keymap)) (p beancount-mode-map-prefix)) (define-key map (kbd "TAB") #'beancount-tab-dwim) + (define-key map (kbd "M-RET") #'beancount-insert-date) (define-key map (vconcat p [(\')]) #'beancount-insert-account) (define-key map (vconcat p [(control g)]) #'beancount-transaction-clear) (define-key map (vconcat p [(l)]) #'beancount-check) @@ -735,6 +736,12 @@ what that column is and returns it (an integer)." )) column)) +(defun beancount-insert-date () + "Start a new timestamped directive." + (interactive) + (unless (bolp) (newline)) + (insert (format-time-string "%Y-%m-%d") " ")) + (defvar beancount-install-dir nil "Directory in which Beancount's source is located. Only useful if you have not installed Beancount properly in your PATH.")