Initial commit from korat

This commit is contained in:
2022-01-18 09:55:24 +01:00
commit 00af380c16
10 changed files with 656 additions and 0 deletions

471
.emacs Normal file
View File

@@ -0,0 +1,471 @@
(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
(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/"))))
'(package-selected-packages
(quote
(projectile langtool flycheck elpy lsp-mode smart-tabs-mode opencl-mode company-go yasnippet-snippets yasnippet company-lsp ess ample-zen-theme auctex-latexmk dockerfile-mode dpkg-dev-el cmake-ide debian-changelog-mode debian-el nginx-mode sudo-edit typescript-mode yaml-mode string-inflection protobuf-mode markdown-mode auctex flymake-go go-mode srefactor company-glsl glsl-mode company company-cmake company-irony company-irony-c-headers irony magit lua-mode)))
'(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-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.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(flymake-errline ((t (:foreground "brightred" :underline t))) t)
'(flymake-infoline ((t (:foreground "color-49" :underline "color-49"))))
'(flymake-warnline ((t (:foreground "color-208" :underline t))) t)
'(font-lock-function-name-face ((t (:foreground "burlywood4"))))
'(font-lock-string-face ((t (:foreground "brightmagenta"))))
'(line-number ((t (:inherit (shadow default) :foreground "gray25"))))
'(line-number-current-line ((t (:inherit line-number :foreground "gray40"))))
'(whitespace-hspace ((t (:foreground "lightgray"))))
'(whitespace-indentation ((t (:foreground "color-52"))))
'(whitespace-newline ((t (:foreground "color-237" :weight normal))))
'(whitespace-space ((t (:foreground "color-237"))))
'(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)
(global-set-key (kbd "<f9>") 'compile)
;;(require 'codyn-mode)
(defun c-c++-header ()
"sets either c-mode or c++-mode, whichever is appropriate for
header"
(interactive)
(let ((c-file (concat (substring (buffer-file-name) 0 -1) "c")))
(if (file-exists-p c-file)
(c-mode)
(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)
(add-to-list 'compilation-error-regexp-alist '("^[0-9]+: \\(.*\\):\\([0-9]+\\): Failure$" 1 2))
(global-set-key (kbd "C-x f") 'find-file-at-point)
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(require 'irony)
(require 'yasnippet)
(push 'glsl-mode irony-supported-major-modes)
(push 'protobuf-mode irony-supported-major-modes)
(push 'opencl-mode irony-supported-major-modes)
(eval-after-load 'company
'(add-to-list
'company-backends
'(company-irony-c-headers company-irony company-yasnippet)))
(require 'company)
(global-company-mode)
(irony-mode)
(define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
(yas-minor-mode)
(require 'srefactor)
; (semantic-mode 1)
(define-key c-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
(define-key c++-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
; (semantic-mode)
; (load-file "/home/tuleu/devel/github.com/ffevotte/clang-tags/build/env.el")
(c-set-offset 'inextern-lang 0)
)
(add-hook 'c-mode-common-hook 'my-c-common-hook)
(defun my-LaTeX-hook ()
(message "LaTeX hook")
;; (require 'auctex-latexmk)
;; (auctex-latexmk-setup)
;; (setq auctex-latexmk-inherit-TeX-PDF-mode t)
(add-to-list 'TeX-command-list
'("latexmk" "latexmk -pdf -interaction=nonstopmode -shell-escape %s" TeX-run-TeX nil t
:help "Run latexmk on file"))
(setq TeX-command-default "latexmk")
; (setq fill-column 10000000)
; (visual-line-mode)
; (window-margin-mode)
; (setq window-margin-width 80)
(setq LaTeX-includegraphics-read-file 'LaTeX-includegraphics-read-file-relative)
(setq LaTeX-includegraphics-strip-extension-flag nil)
(add-to-list 'LaTeX-includegraphics-extensions '"tikz")
;; use Okular as default pdf viewer
(setq TeX-view-program-selection '((output-pdf "Okular PDF Viewer")))
(add-to-list 'TeX-expand-list '("%(dir)" (lambda nil (expand-file-name (TeX-master-directory)))))
(setq TeX-view-program-list
'(("Okular PDF Viewer" "okular --unique %o#src:%n%(dir)./%b")))
;; (setq auctex-latexmk-inherit-TeX-PDF-mode t)
;; launch server if not launched
(load "server")
(unless (server-running-p) (server-start))
)
(add-hook 'LaTeX-mode-hook 'my-LaTeX-hook)
(defun my-TeX-hook ()
(message "TeX hook")
(setq reftex-plug-into-AUCTeX t)
(global-set-key (kbd "C-x f") 'find-file-at-point)
(turn-on-reftex)
(setq TeX-parse-self t)
(setq TeX-auto-save t)
(TeX-PDF-mode)
(setq reftex-ref-macro-prompt nil)
(defun my-latex-insert-cite (&optional P)
""
(interactive "P")
(TeX-insert-macro "cite")
)
(define-key LaTeX-mode-map [remap reftex-citation] 'my-latex-insert-cite)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq-default TeX-master nil)
(defun my-latex-fill-paragraph (&optional P)
"When called with prefix argument call `fill-paragraph'.
Otherwise split the current paragraph into one sentence per line."
(interactive "P")
(if (not P)
(save-excursion
(let ((fill-column 12345678)) ;; relies on dynamic binding
(fill-paragraph) ;; this will not work correctly if the paragraph is
;; longer than 12345678 characters (in which case the
;; file must be at least 12MB long. This is unlikely.)
(let ((end (save-excursion
(forward-paragraph 1)
(backward-sentence)
(point-marker)))) ;; remember where to stop
(beginning-of-line)
(while (progn (forward-sentence)
(<= (point) (marker-position end)))
(just-one-space) ;; leaves only one space, point is after it
(delete-char -1) ;; delete the space
(insert " %");; insert a %
(newline) ;; and insert a newline
(LaTeX-indent-line) ;; I only use this in combination with late, so this makes sense
))))
;; otherwise do ordinary fill paragraph
(fill-paragraph P))
)
(define-key LaTeX-mode-map (kbd "M-q") 'my-latex-fill-paragraph)
)
(add-hook 'TeX-mode-hook 'my-TeX-hook)
(defun my-markdown-hook ()
(defun my-markdown-preview-buffer ()
(require 'shr)
(require 'eww)
(interactive)
(let* ((buf-this (buffer-name (current-buffer)))
(buf-html (get-buffer-create
(format "*my-md-html (%s)*" buf-this))))
(markdown-other-window (buffer-name buf-html))
(shr-render-buffer buf-html)
(eww-mode)
(kill-buffer buf-html))
)
(global-set-key (kbd "C-c C-c C-p") 'my-markdown-preview-buffer)
(setq markdown-command "remarkable")
)
(add-hook 'markdown-mode-hook 'my-markdown-hook)
(defun my-gfm-mode-hook ()
(setq markdown-command "remarkable")
)
(add-hook 'gfm-mode-hook 'my-gfm-mode-hook)
(defun my-python-mode-hook ()
(require 'elpy)
(require 'flycheck)
(elpy-enable)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook (lambda ()
(add-hook 'before-save-hook
'elpy-black-fix-code nil t)))
(elpy-mode)
)
(add-hook 'python-mode-hook 'my-python-mode-hook)
(defun my-after-init-hook ()
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . gfm-mode))
(require 'smart-tabs-mode)
(smart-tabs-add-language-support cmake cmake-mode-hook
(
(cmake-indent . cmake-tab-width)
)
)
(smart-tabs-add-language-support protobuf protobuf-mode-hook
(
(c-indent-line . c-basic-offset)
(c-indent-region . c-basic-offset)
)
)
(smart-tabs-add-language-support html html-mode-hook
(
(sgml-indent-line . sgml-basic-offset)
)
)
(smart-tabs-add-language-support glsl glsl-mode-hook
(
(c-indent-line . c-basic-offset)
(c-indent-region . c-basic-offset)
)
)
(smart-tabs-add-language-support opencl opencl-mode-hook
(
(c-indent-line . c-basic-offset)
(c-indent-region . c-basic-offset)
)
)
(smart-tabs-insinuate 'c 'javascript 'c++ 'cmake 'nxml 'protobuf 'html 'glsl)
;; do things after package initialization
(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)