Uses projectile-compile-command instead of legacy <f9>

This commit is contained in:
2022-10-05 08:00:36 +02:00
parent b3ab5ccdc6
commit 4bc4e435c7

18
.emacs
View File

@@ -1,5 +1,3 @@
;(toggle-debug-on-error) ;(toggle-debug-on-error)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;lsp performances ;lsp performances
@@ -80,7 +78,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keymap ;; Keymap
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "<f9>") 'compile)
(use-package smart-tabs-mode (use-package smart-tabs-mode
:config :config
@@ -337,13 +334,24 @@
) )
(use-package go-mode (use-package go-mode
:after (projectile)
:config :config
(setq gofmt-command "goimports") (setq gofmt-command "goimports")
(unbind-key "C-c C-d" go-mode-map) (unbind-key "C-c C-d" go-mode-map)
(add-hook 'before-save-hook 'gofmt-before-save) (add-hook 'before-save-hook 'gofmt-before-save)
(setq compile-command "go build && go test -coverprofile=cover.out && go tool cover -html cover.out -o /tmp/cover.html") ;;(setq compile-command "go build && go test -coverprofile=cover.out && go tool cover -html cover.out -o /tmp/cover.html")
(defun go-compile-command ()
"returns a string to compile a go project"
(setq project-makefile (concat (file-name-as-directory (projectile-project-root)) "Makefile"))
(if (file-exists-p project-makefile)
(concat "make -C" (projectile-project-root))
"go build && go test && go vet"
)
)
(projectile-update-project-type
'go
:compile 'go-compile-command)
) )
(use-package glsl-mode) (use-package glsl-mode)
(use-package opencl-mode) (use-package opencl-mode)