From 855f671c3f2ef299f085c3cc4ae7f609118f9454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Mon, 17 May 2021 09:58:50 +0200 Subject: ledger invoice import --- config/doom/config.org | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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" -- cgit v1.2.3