aboutsummaryrefslogtreecommitdiffstats
path: root/config/doom
diff options
context:
space:
mode:
Diffstat (limited to 'config/doom')
-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"