aboutsummaryrefslogtreecommitdiff
path: root/tw/home/emacs.scm
blob: d3696ac213d7baf5d443d24fab62e588fd1c75fc (about) (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
(define-module (tw home emacs)
  #:use-module (gnu)
  #:use-module (gnu home services)
  #:use-module (gnu home services shepherd)
  #:use-module (tw theme))

(use-package-modules base cmake emacs emacs-xyz databases finance haskell-apps llvm
                     python-xyz sqlite)

(define-public emacs-packages
  (list
   ;; Development & language servers
   gnu-make
   shellcheck
   clang  ; for clangd
   python-lsp-server
   ;; Supported OotB by eglot, but not packaged by guix:
   ;; https://github.com/mads-hartmann/bash-language-server
   ;; https://github.com/regen100/cmake-language-server
   ;; https://github.com/hrsh7th/vscode-langservers-extracted   ; {html,css,json}-languageserver
   ;; https://github.com/golang/tools/tree/master/gopls         ; maybe?
   ;; https://github.com/artempyanykh/marksman                  ; Markdown
   ;; https://github.com/jeapostrophe/racket-langserver
   ;; https://github.com/astoff/digestif                        ; (La)TeX
   ;; https://github.com/redhat-developer/yaml-language-server
   ;; Needs eglot config + not packaged (from lsp-mode):
   ;; https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-cli#readme
   ;; https://github.com/haskell/haskell-language-server / https://github.com/haskell/ghcide
   ;; https://github.com/eclipse/lemminx

   ;; Emacs general
   emacs
   emacs-use-package
   emacs-eglot
   emacs-counsel
   emacs-counsel-dash sqlite  ; emacs-counsel-dash requires the sqlite3 binary
   emacs-ivy
   ;; emacs-company emacs-company-quickhelp emacs-company-posframe
   emacs-corfu emacs-corfu-doc
   emacs-autothemer  ; for catppuccin/emacs
   emacs-undo-tree
   emacs-aggressive-indent
   emacs-which-key
   emacs-smart-mode-line
   emacs-diminish
   emacs-rainbow-mode
   emacs-guix
   ;; TODO: emacs-editorconfig emacs-sly emacs-sly-macrostep
   emacs-org   ; emacs-org-modern theme?

   ;; Emacs Evil
   emacs-evil
   emacs-evil-collection
   emacs-evil-expat  ; for :reverse, :remove, :rename, :colo, :g*, ... ex commands
   emacs-evil-surround
   ;; emacs-evil-owl  ; tests failing
   emacs-evil-args
   emacs-evil-numbers
   emacs-evil-multiedit
   emacs-evil-goggles
   emacs-evil-traces
   emacs-evil-commentary
   emacs-evil-replace-with-register
   emacs-evil-org
   emacs-evil-markdown
   emacs-evil-tex
   emacs-evil-text-object-python

   ;; Emacs language modes
   emacs-geiser emacs-geiser-racket emacs-geiser-guile
   ;; emacs-macrostep-geiser
   emacs-flymake-collection  ; emacs-flymake-flycheck  ; if needed
   emacs-cmake-mode emacs-gnuplot emacs-graphviz-dot-mode
   emacs-hcl-mode emacs-ledger-mode emacs-mmm-mode
   emacs-puppet-mode emacs-rec-mode emacs-web-mode
   emacs-yaml-mode))

(define-public emacs-services
  (list
   (simple-service
    'emacs-config home-xdg-configuration-files-service-type
    `(("emacs/include" ,(local-file "files/emacs-packages" #:recursive? #t))
      ("emacs/init.el" ,(local-file "files/emacs-init.el"))
      (,(string-append "emacs/" (local-file-name catppuccin-emacs-theme))
       ,catppuccin-emacs-theme)))

   (simple-service
    'emacs-is-editor home-environment-variables-service-type
    `(("EDITOR" . "emacsclient -qc")
      ;; Tell emacsclient to return immediately after opening the file.  I
      ;; can't put this in $EDITOR as many programs expect $EDITOR to exit
      ;; only when the user is done editing.
      ("ASYNC_EDITOR" . "emacsclient -qcn")))

   (simple-service
    'emacs-server home-shepherd-service-type
    (list
     (shepherd-service
      (documentation "Emacs server; connect using emacsclient.")
      (provision '(emacs))
      (start #~(make-forkexec-constructor
                (list #$(file-append emacs "/bin/emacs") "--fg-daemon")))
      (stop #~(make-kill-destructor)))))))