aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/doom/config.org19
1 files changed, 19 insertions, 0 deletions
diff --git a/config/doom/config.org b/config/doom/config.org
index 1153a9d..c786353 100644
--- a/config/doom/config.org
+++ b/config/doom/config.org
@@ -265,6 +265,25 @@ this new window.
(add-hook 'message-send-mail-hook 'set-smtp-server))
#+end_src
+* Ledger
+Emacs mode for managing ledger text files
+#+BEGIN_SRC emacs-lisp
+(after! ledger-mode
+ (setq ledger-default-date-format ledger-iso-date-format)
+
+ (defun on/ledger-link-invoice ()
+ "Attach an invoice file to this posting."
+ (interactive)
+ (when-let* ((date (ledger-xact-date))
+ (payee (replace-regexp-in-string " " "_" (string-trim-right (ledger-xact-payee))))
+ (src-file (read-file-name "Attach: " "~/dev/journal/Empresa_DE/"))
+ (file-name (concat "Empresa_DE/" date "_" payee "." (file-name-extension src-file))))
+ (ledger-navigate-beginning-of-xact)
+ (end-of-line)
+ (rename-file src-file (expand-file-name file-name "/home/titan/dev/journal/"))
+ (newline)
+ (insert " ; Invoice: " file-name))))
+#+end_src
* Programming languages
** Haskell
#+begin_src emacs-lisp :tangle "packages.el"