Refactors .emacs

This commit is contained in:
2022-01-18 11:18:38 +01:00
parent c74b62a692
commit 1a7119fffc

327
.emacs
View File

@@ -1,45 +1,16 @@
(global-set-key (kbd "M-p") 'backward-paragraph)
(global-set-key (kbd "M-n") 'forward-paragraph)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default bold shadow italic underline bold bold-italic bold])
'(ansi-color-names-vector
(vector "#eaeaea" "#d54e53" "DarkOliveGreen3" "#e7c547" "DeepSkyBlue1" "#c397d8" "#70c0b1" "#181a26"))
'(c-default-style
(quote
((c++-mode . "tuleu-c++")
(java-mode . "java")
(awk-mode . "awk")
(other . "gnu"))))
'(company-idle-delay 20.0)
'(company-quickhelp-color-background "#4F4F4F")
'(company-quickhelp-color-foreground "#DCDCCC")
'(compilation-scroll-output (quote first-error))
'(custom-safe-themes
(quote
("842bf45f64e12795d4b8dcc9a30c1b5396b7794b12cedd81fd4531193b864872" "2540689fd0bc5d74c4682764ff6c94057ba8061a98be5dd21116bf7bf301acfb" "cdb4ffdecc682978da78700a461cdc77456c3a6df1c1803ae2dd55c59fa703e3" "332fcf3c7208aca9fab65d54203f78a242482e7fd65f5725a2482c20b1730732" "c7f10959cb1bc7a36ee355c765a1768d48929ec55dde137da51077ac7f899521" "c9ddf33b383e74dac7690255dd2c3dfa1961a8e8a1d20e401c6572febef61045" "bf798e9e8ff00d4bf2512597f36e5a135ce48e477ce88a0764cfb5d8104e8163" "36ca8f60565af20ef4f30783aa16a26d96c02df7b4e54e9900a5138fb33808da" "2a7beed4f24b15f77160118320123d699282cbf196e0089f113245d4b729ba5d" default)))
'(display-line-numbers-type t)
'(fci-rule-color "#14151E")
'(global-auto-revert-mode t)
'(global-display-line-numbers-mode t)
'(gofmt-command "goimports")
'(inhibit-startup-screen t)
'(linum-format "%03d ")
'(magit-revert-buffers (quote silent) t)
'(markdown-css-paths
(quote
("file:///home/tuleu/.config/markdown/css/retro.css")))
'(nrepl-message-colors
(quote
("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
'(org-agenda-files (quote ("~/org/1.TODO.org")))
'(package-archives
(quote
@@ -51,73 +22,14 @@
'(pdf-view-midnight-colors (quote ("#DCDCCC" . "#383838")))
'(safe-local-variable-values
(quote
((TeX-master . "../../../main_fr.tex")
(TeX-master . "../../../main_fr")
(TeX-master . "../../../main_en")
(TeX-master . t)
(cmake-ide-build-dir . "/home/tuleu/devel/formicidae-tracker/fort-studio/build")
(cmake-ide-project-dir . "/home/tuleu/devel/formicidae-tracker/fort-studio")
(eval progn
(let
((project-root-directory
(when buffer-file-name
(locate-dominating-file buffer-file-name ".dir-locals.el")))))
(when project-root-directory
(setq compile-command
(concat "make -j 7 -C " project-root-directory))))
(irony-additional-clang-options concat
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/src")
((TeX-master . t)
(TeX-parse-self . t)
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build all check doc")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build -j 7 all")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build-trusty")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build -j 7")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build -j 7 check")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")
"/build -j 7 all check")
(compile-command concat "make -C "
(locate-dominating-file buffer-file-name ".dir-locals.el")))))
)))
'(srefactor--getter-prefix "Get")
'(srefactor--getter-setter-capitalize-p t)
'(srefactor--setter-prefix "Set")
'(tab-width 4)
'(vc-annotate-background nil)
'(vc-annotate-color-map
(quote
((20 . "#d54e53")
(40 . "goldenrod")
(60 . "#e7c547")
(80 . "DarkOliveGreen3")
(100 . "#70c0b1")
(120 . "DeepSkyBlue1")
(140 . "#c397d8")
(160 . "#d54e53")
(180 . "goldenrod")
(200 . "#e7c547")
(220 . "DarkOliveGreen3")
(240 . "#70c0b1")
(260 . "DeepSkyBlue1")
(280 . "#c397d8")
(300 . "#d54e53")
(320 . "goldenrod")
(340 . "#e7c547")
(360 . "DarkOliveGreen3"))))
'(vc-annotate-very-old-color nil))
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -137,37 +49,39 @@
'(whitespace-space-after-tab ((t (:foreground "firebrick"))))
'(whitespace-tab ((t (:foreground "color-237")))))
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode ))
(toggle-scroll-bar -1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(set-face-attribute 'default nil :height 70)
;;(setq package-enable-at-startup nil)
;;(package-initialize)
;; (require 'auto-complete)
;; (require 'auto-complete-config)
;; (if (getenv "GOPATH")
;; (progn
;; (require 'go-autocomplete)
;; (add-to-list 'load-path (concat (getenv "GOPATH") "/src/github.com/golang/lint/misc/emacs"))
;; (require 'golint)
;; )
;; ()
;; )
;; (ac-config-default)
;; (define-key ac-mode-map (kbd "M-TAB") 'auto-complete)
;; (setq ac-auto-start nil)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keymap
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "<f9>") 'compile)
(global-set-key (kbd "C-x g") 'magit-status)
;;(require 'codyn-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Company
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-company-mode-hook ()
(global-set-key (kbd "C-M-i") 'company-complete))
(add-hook 'company-mode-hook 'my-company-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CMake
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-cmake-mode-hook ()
(company-mode)
)
(add-hook 'cmake-mode-hook 'my-cmake-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C/C++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c-c++-header ()
"sets either c-mode or c++-mode, whichever is appropriate for
@@ -179,62 +93,6 @@ header"
(c++-mode))))
(add-to-list 'auto-mode-alist '("\\.h\\'" . c-c++-header))
(require 'iso-transl)
;; (require 'hideshow)
;; (require 'sgml-mode)
;; (require 'nxml-mode)
;; (add-to-list 'hs-special-modes-alist
;; '(nxml-mode
;; "<!--\\|<[^/>]*[^/]>"
;; "-->\\|</[^/>]*[^/]>"
;; "<!--"
;; sgml-skip-tag-forward
;; nil))
;; (add-hook 'nxml-mode-hook 'hs-minor-mode)
;; ;; optional key bindings, easier than hs defaults
;; (define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding)
(defconst tuleu-cc-style
'("gnu"
(c-offsets-alist . ((innamespace . [0])))
)
)
(c-add-style "tuleu-c++" tuleu-cc-style)
(global-set-key (kbd "C-x g") 'magit-status)
(defun my-company-mode-hook ()
(global-set-key (kbd "C-M-i") 'company-complete))
(add-hook 'company-mode-hook 'my-company-mode-hook)
;(add-hook 'c++-mode-hook 'irony-mode)
;(add-hook 'c-mode-hook 'irony-mode)
;(add-hook 'c++-mode-hook 'company-mode)
;(add-hook 'c-mode-hook 'company-mode)
(defun my-cmake-mode-hook ()
(company-mode)
)
(add-hook 'cmake-mode-hook 'my-cmake-mode-hook)
(defun my-c-common-hook ()
(global-set-key (kbd "C-c C-h") 'ff-find-other-file)
(require 'compile)
@@ -268,7 +126,9 @@ header"
(add-hook 'c-mode-common-hook 'my-c-common-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TeX/LaTeX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-LaTeX-hook ()
(message "LaTeX hook")
;; (require 'auctex-latexmk)
@@ -344,8 +204,9 @@ Otherwise split the current paragraph into one sentence per line."
)
(add-hook 'TeX-mode-hook 'my-TeX-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Markdown
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-markdown-hook ()
(defun my-markdown-preview-buffer ()
@@ -369,6 +230,10 @@ Otherwise split the current paragraph into one sentence per line."
)
(add-hook 'gfm-mode-hook 'my-gfm-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Python
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-python-mode-hook ()
(require 'elpy)
(require 'flycheck)
@@ -381,6 +246,74 @@ Otherwise split the current paragraph into one sentence per line."
)
(add-hook 'python-mode-hook 'my-python-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Golang
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-go-hook ()
(require 'company)
(require 'company-go)
;; (require 'flymake-go)
(company-mode)
(setq gofmt-command "goimports")
(add-hook 'before-save-hook 'gofmt-before-save)
(set (make-local-variable 'company-backends) '(company-go))
(flymake-mode)
(global-set-key (kbd "C-c C-h") 'godef-describe)
(global-set-key (kbd "C-c C-j") 'godef-jump)
(setq compile-command "go build && go test -coverprofile=cover.out && go tool cover -html cover.out -o /tmp/cover.html")
)
(add-hook 'go-mode-hook 'my-go-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HTML
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-html-hook ()
(add-hook 'before-save-hook 'delete-trailing-whitespace)
)
(add-hook 'html-mode-hook 'my-html-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Protobuf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-protobuf-mode-hook ()
(defconst my-protobuf-style
'((c-basic-offset . 4)
(indent-tabs-mode . t)))
(c-add-style "my-style" my-protobuf-style t)
(smart-tabs-mode)
)
(add-hook 'protobuf-mode-hook 'my-protobuf-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Typescript
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;l
(defun my-typescript-mode-hook ()
(setq create-lockfiles nil)
(add-to-list 'compilation-error-regexp-alist '("^Error: \\(.*?\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3))
)
(add-hook 'typescript-mode-hook 'my-typescript-mode-hook)
(with-eval-after-load 'typescript-mode (add-hook 'typescript-mode-hook #'lsp))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Language tool
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq langtool-language-tool-server-jar "~/.languagetool/languagetool-server.jar")
(setq langtool-default-language "en-US")
(global-set-key (kbd "C-c l c") 'langtool-check)
(global-set-key (kbd "C-c l d") 'langtool-check-done)
(global-set-key (kbd "C-c l l") 'langtool-switch-default-language)
(global-set-key (kbd "C-c l s") 'langtool-show-message-at-point)
(global-set-key (kbd "C-c l b") 'langtool-correct-buffer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; After Init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-after-init-hook ()
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . gfm-mode))
@@ -419,53 +352,3 @@ Otherwise split the current paragraph into one sentence per line."
(load-theme 'ample-zen t)
)
(add-hook 'after-init-hook 'my-after-init-hook)
(defun my-go-hook ()
(require 'company)
(require 'company-go)
;; (require 'flymake-go)
(company-mode)
(setq gofmt-command "goimports")
(add-hook 'before-save-hook 'gofmt-before-save)
(set (make-local-variable 'company-backends) '(company-go))
(flymake-mode)
(global-set-key (kbd "C-c C-h") 'godef-describe)
(global-set-key (kbd "C-c C-j") 'godef-jump)
(setq compile-command "go build && go test -coverprofile=cover.out && go tool cover -html cover.out -o /tmp/cover.html")
)
(add-hook 'go-mode-hook 'my-go-hook)
(defun my-html-hook ()
(add-hook 'before-save-hook 'delete-trailing-whitespace)
)
(add-hook 'html-mode-hook 'my-html-hook)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(defun my-protobuf-mode-hook ()
(defconst my-protobuf-style
'((c-basic-offset . 4)
(indent-tabs-mode . t)))
(c-add-style "my-style" my-protobuf-style t)
(smart-tabs-mode)
)
(add-hook 'protobuf-mode-hook 'my-protobuf-mode-hook)
(defun my-typescript-mode-hook ()
(setq create-lockfiles nil)
(add-to-list 'compilation-error-regexp-alist '("^Error: \\(.*?\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3))
)
(add-hook 'typescript-mode-hook 'my-typescript-mode-hook)
(with-eval-after-load 'typescript-mode (add-hook 'typescript-mode-hook #'lsp))
(setq langtool-language-tool-server-jar "~/.languagetool/languagetool-server.jar")
(setq langtool-default-language "en-US")
(global-set-key (kbd "C-c l c") 'langtool-check)
(global-set-key (kbd "C-c l d") 'langtool-check-done)
(global-set-key (kbd "C-c l l") 'langtool-switch-default-language)
(global-set-key (kbd "C-c l s") 'langtool-show-message-at-point)
(global-set-key (kbd "C-c l b") 'langtool-correct-buffer)