Add Emacs desktop provisioning and dev toolchain packages

Install Emacs and copy the desktop .emacs.d config so the editor setup is managed with the rest of desktop dotfiles. Add vterm/build/debug dependencies plus C/C++ and Go tooling needed by the configured workflow.
This commit is contained in:
Fabio Scotto di Santolo
2026-03-17 11:50:59 +01:00
parent fa457c4a42
commit 0826265363
148 changed files with 2048 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
;; c.el -*- lexical-binding: t; -*-
;; C / C++ fallback style (Linux-like)
(setq c-default-style "linux"
c-basic-offset 4
tab-width 8)
(add-hook 'c-mode-common-hook
(lambda ()
(setq indent-tabs-mode t)))
;; Tree-sitter C/C++
(setq c-ts-mode-indent-offset 4)
(setq c++-ts-mode-indent-offset 4)
(with-eval-after-load 'lsp
;; Clangd configurations
(setq lsp-clients-clangd-args
'("--background-index"
"--clang-tidy"
"--completion-style=detailed"
"--header-insertion=never"
"--header-insertion-decorators"
"--pch-storage=memory"
"--log=error"
"--ranking-model=heuristics"
"--malloc-trim"
"--limit-results=500"
"--limit-references=2000")))
(with-eval-after-load 'dap-mode
(require 'dap-cpptools))
(add-hook 'c-ts-mode-hook #'fscotto/disable-c-formatting)
(add-hook 'c-mode-hook #'fscotto/disable-c-formatting)
(provide 'c)
;;; c.el ends here

View File

@@ -0,0 +1,8 @@
;;; docker.el -*- lexical-binding: t; -*-
(use-package dockerfile-mode
:ensure t)
(provide 'docker)
;;; docker.el ends here

View File

@@ -0,0 +1,89 @@
;;=================================================================
;; Go Language Support
;;=================================================================
(use-package go-ts-mode
:ensure nil
:mode "\\.go\\'"
:hook
((go-ts-mode . lsp-deferred)
(go-ts-mode . fscotto/go-format-on-save)))
(use-package go-mod-ts-mode
:ensure nil
:mode
(("/go\\.mod\\'" . go-mod-ts-mode)
("/go\\.sum\\'" . go-mod-ts-mode))
:hook
((go-mod-ts-mode . lsp-deferred)
;; restart gopls only when go.mod/go.sum are saved (buffer-local)
(go-mod-ts-mode . (lambda ()
(add-hook 'after-save-hook
(lambda ()
(when (lsp-workspaces)
(lsp-restart-workspace)))
nil t)))))
(with-eval-after-load 'project
(add-to-list 'project-vc-extra-root-markers "go.mod"))
(with-eval-after-load 'lsp-mode
;; gopls settings (single source of truth)
(lsp-register-custom-settings
'(("gopls.staticcheck" t)
("gopls.gofumpt" t)
;; ("gopls.experimentalWorkspaceModule" t)
("gopls.expandWorkspaceToModule" t)
("gopls.directoryFilters" ["-vendor"])
("gopls.analyses.unusedparams" t)
("gopls.analyses.shadow" t)
("gopls.analyses.nilness" t)
("gopls.analyses.useany" t)
("gopls.env" ((GO111MODULE . "on"))))))
(with-eval-after-load 'flycheck
;; Usa golangci-lint in Go
(add-hook 'go-ts-mode-hook
(lambda ()
(setq-local flycheck-checker 'golangci-lint)
(setq-local flycheck-check-syntax-automatically '(save mode-enabled))
(flycheck-mode 1))))
(use-package dap-dlv-go
:after (dap-mode go-ts-mode))
(with-eval-after-load 'dap-dlv-go
;; Debug all tests in module
(dap-register-debug-template
"Go :: Debug all tests"
(list :type "go"
:request "launch"
:name "Go :: Debug all tests"
:mode "test"
:program "${workspaceFolder}"
:cwd "${workspaceFolder}"))
;; Debug tests in current package
(dap-register-debug-template
"Go :: Debug package tests"
(list :type "go"
:request "launch"
:name "Go :: Debug package tests"
:mode "test"
:program "${fileDirname}"
:cwd "${fileDirname}"))
;; Debug test at point
(dap-register-debug-template
"Go :: Debug test at point"
(list :type "go"
:request "launch"
:name "Go :: Debug test at point"
:mode "test"
:program "${fileDirname}"
:cwd "${fileDirname}"
:args (list "-test.run" "${input:testName}"))))
(add-hook 'dap-terminated-hook
(lambda (_)
(delete-other-windows)))

View File

@@ -0,0 +1,7 @@
;;; json.el -*- lexical-binding: t -*-
(use-package json-mode
:ensure t)
(provide 'json)
;;; json.el ends here

View File

@@ -0,0 +1,8 @@
;;; markdown.el -*- lexical-binding: t; -*-
(use-package markdown-mode
:ensure t
:mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown"))
(provide 'markdown)
;;; markdown.el ends here

View File

@@ -0,0 +1,46 @@
;;; org.el -*- lexical-binding: t; -*-
(use-package htmlize
:ensure t)
(use-package org
:init
(setq org-clock-mode-line-total 'today
org-fontify-quote-and-verse-blocks t
org-indent-mode t
org-return-follows-link t
org-startup-folded 'content
org-todo-keywords '((sequence "🆕(t)" "▶️(s)" "⏳(w)" "🔎(p)" "|" "✅(d)" "🗑(c)" "👨(g)")))
:config
(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook 'flyspell-mode))
(use-package org-bullets
:ensure t
:init
(setq org-bullets-bullet-list '("" "" "" "" ""))
:config
(add-hook 'org-mode-hook 'org-bullets-mode))
(use-package org-re-reveal
:ensure t
:init
(setq org-re-reveal-transition 'none
org-re-reveal-theme "dracula"))
(use-package ob-mermaid
:ensure t
:init
(setq ob-mermaid-cli-path "mmdc")
(org-babel-do-load-languages
'org-babel-load-languages
'((mermaid . t)
(scheme . t))))
;; Setting default directory for Org files
(setq org-directory "~/Remotes/pCloud/Org")
(provide 'org)
;;; org.el ends here

View File

@@ -0,0 +1,11 @@
(with-eval-after-load 'flycheck
(add-hook 'bash-ts-mode-hook 'flycheck-mode))
(use-package reformatter
:ensure t
:config
(reformatter-define shfmt-format
:program "shfmt"
:args '("-i" "2" "-ci")))
(add-hook 'bash-ts-mode-hook #'shfmt-format-on-save-mode)

View File

@@ -0,0 +1,8 @@
;;; yaml.el -*- lexical-binding: t; -*-
(use-package yaml-mode
:ensure t)
(provide 'yaml)
;;; yaml.el ends here