aboutsummaryrefslogtreecommitdiff
path: root/tw/home/emacs.scm
diff options
context:
space:
mode:
authorTimo Wilken2022-12-31 11:46:26 +0100
committerTimo Wilken2022-12-31 11:46:26 +0100
commit336b73fd56ae24f3bd363f43263a671af92240f0 (patch)
tree904644d1354068c061caabbed76790429262dac3 /tw/home/emacs.scm
parentc629e4243330b5081c4b85563fe9c028e43310c2 (diff)
Extract common home configuration for server and laptop
Diffstat (limited to 'tw/home/emacs.scm')
-rw-r--r--tw/home/emacs.scm103
1 files changed, 103 insertions, 0 deletions
diff --git a/tw/home/emacs.scm b/tw/home/emacs.scm
new file mode 100644
index 00000000..d3696ac2
--- /dev/null
+++ b/tw/home/emacs.scm
@@ -0,0 +1,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)))))))