(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. '(company-idle-delay 20.0) '(display-line-numbers-type t) '(global-auto-revert-mode t) '(global-display-line-numbers-mode t) '(gofmt-command "goimports") '(inhibit-startup-screen t) '(magit-revert-buffers (quote silent) t) '(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 . t) (TeX-parse-self . t) ))) '(srefactor--getter-prefix "Get") '(srefactor--getter-setter-capitalize-p t) '(srefactor--setter-prefix "Set") '(tab-width 4) ) (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)) (add-hook 'before-save-hook 'delete-trailing-whitespace) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Keymap ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (global-set-key (kbd "") 'compile) (global-set-key (kbd "C-x g") 'magit-status) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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 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)) (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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TeX/LaTeX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Markdown ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Python ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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)) (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)