~abcdw/rde

rde/rde/features/finance.scm -rw-r--r-- 1.6 KiB
e98d6a8eAndrew Tropin rde: gnupg: Add copyright preamble. 19 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(define-module (rde features finance)
  #:use-module (rde features)
  #:use-module (rde features emacs)
  #:use-module (rde features predicates)
  #:use-module (gnu services)
  #:use-module (gnu home services)
  #:use-module (gnu packages finance)
  #:use-module (gnu packages emacs-xyz)
  #:use-module (guix gexp)

  #:export (feature-ledger))


;;;
;;; ledger.
;;;

(define* (feature-ledger
          #:key
          (ledger ledger)
          (emacs-ledger-mode emacs-ledger-mode))
  "Setup and configure ledger related things."
  (ensure-pred file-like? ledger)
  (ensure-pred file-like? emacs-ledger-mode)

  (define (get-home-services config)
    (define emacs-f-name 'ledger)
    (define emacs-cmd (get-value 'emacs-client-create-frame config))

    (list
     (simple-service
      'ledger-add-ledger-package
      home-profile-service-type
      (list ledger)) ;; Needed for info pages

     ;; TODO: Build emacs-ledger with ledger specified in feature argument.
     (when (get-value 'emacs config)
       (rde-elisp-configuration-service
        emacs-f-name
        config
        `((with-eval-after-load
           'ledger-mode
           (setq ledger-default-date-format ledger-iso-date-format)))
        #:summary "\
Tweaks for ledger-mode"
        #:commentary "\
Use ISO date."
        #:keywords '(convenience)
        #:elisp-packages (list (get-value 'emacs-configure-rde-keymaps config)
                               emacs-ledger-mode)))))

  (feature
   (name 'ledger)
   (values `((ledger . #t)
             (emacs-ledger-mode . emacs-ledger-mode)))
   (home-services-getter get-home-services)))