aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-08-25 11:58:36 +0200
committerOscar Najera <hi@oscarnajera.com>2023-08-25 11:58:36 +0200
commit85d0c2059d2255c0bb05c3fd38a45fd182b22d88 (patch)
tree47f82871c3b09eb05cbc96c030c76d0aec3fdde4
parent5f4910a4f77b94ae5126ffd6a1c6134c9a5b379f (diff)
downloaddotfiles-85d0c2059d2255c0bb05c3fd38a45fd182b22d88.tar.gz
dotfiles-85d0c2059d2255c0bb05c3fd38a45fd182b22d88.tar.bz2
dotfiles-85d0c2059d2255c0bb05c3fd38a45fd182b22d88.zip
link invoice ledger
-rw-r--r--config/doom/config.org16
1 files changed, 9 insertions, 7 deletions
diff --git a/config/doom/config.org b/config/doom/config.org
index 43a567a..cf4e74e 100644
--- a/config/doom/config.org
+++ b/config/doom/config.org
@@ -460,15 +460,17 @@ Emacs mode for managing ledger text files
(defun on/ledger-link-invoice ()
"Attach an invoice file to this posting."
(interactive)
+ (ledger-navigate-beginning-of-xact)
+ (end-of-line)
(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/"))
+ (payee (thread-last
+ (ledger-xact-payee)
+ (string-trim)
+ (replace-regexp-in-string (rx (+ (or space punctuation))) "_")))
+ (src-file (read-file-name "Attach: "))
(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))))
+ (insert "\n ; Invoice: " file-name)
+ (rename-file src-file (expand-file-name file-name)))))
#+end_src
** CSV
#+begin_src emacs-lisp :tangle "packages.el"