Add custom latex setup and theme for emacs.

This commit is contained in:
Mikaël Capelle 2016-03-15 07:50:19 +01:00
parent 7360b81ba1
commit 402355879f

View File

@ -44,7 +44,8 @@
(append '(ac-source-clang-async) (append '(ac-source-clang-async)
ac-sources)) ac-sources))
(add-to-list 'ac-sources 'ac-source-c-headers) (add-to-list 'ac-sources 'ac-source-c-headers)
(ac-clang-launch-completion-process)) (ac-clang-launch-completion-process)
(hs-minor-mode))
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup) (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'c++-mode-common-hook 'ac-cc-mode-setup) (add-hook 'c++-mode-common-hook 'ac-cc-mode-setup)
@ -69,6 +70,48 @@
(setq TeX-parse-self t) (setq TeX-parse-self t)
(setq-default TeX-master nil) (setq-default TeX-master nil)
(defun my-latex-mode-setup ()
"Redefines and updates variables for various customizations."
(setq LaTeX-paragraph-commands
'("If" "State" "Loop" "For" "ForAll"))
(setq LaTeX-begin-regexp
(concat LaTeX-begin-regexp "\\|If\\b" "\\|Loop\\b" "\\|For\\b" "\\|ForAll\\b"))
(setq LaTeX-end-regexp
(concat LaTeX-end-regexp "\\|EndIf\\b" "\\|EndLoop\\b"
"\\|EndFor\\b" "\\|Else\\b" "\\|ElsIf\\b"))
(setq LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make))
(defun LaTeX-indent-level-count ()
"Count indentation change caused by all \\left, \\right, \\begin, and
\\end commands in the current line."
(save-excursion
(save-restriction
(let ((count 0))
(narrow-to-region (point)
(save-excursion
(re-search-forward
(concat "[^" TeX-esc "]"
"\\(" LaTeX-indent-comment-start-regexp
"\\)\\|\n\\|\\'"))
(backward-char)
(point)))
(while (search-forward TeX-esc nil t)
(cond
((looking-at "left\\b")
(setq count (+ count LaTeX-left-right-indent-level)))
((looking-at "right\\b")
(setq count (- count LaTeX-left-right-indent-level)))
((looking-at LaTeX-begin-regexp)
(setq count (+ count LaTeX-indent-level)))
((looking-at "Else\\b"))
((looking-at "ElsIf\\b"))
((looking-at LaTeX-end-regexp)
(setq count (- count LaTeX-indent-level)))
((looking-at (regexp-quote TeX-esc))
(forward-char 1))))
count)))))
(add-hook 'LaTeX-mode-hook 'my-latex-mode-setup)
(add-hook 'LaTeX-mode-hook 'visual-line-mode) (add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode) (add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
@ -118,6 +161,9 @@
;; White space mode ;; White space mode
(setq whitespace-line-column 100) (setq whitespace-line-column 100)
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'python-mode-hook (lambda () (setq whitespace-line-column 140))) (add-hook 'python-mode-hook (lambda () (setq whitespace-line-column 140)))
(add-hook 'LaTeX-mode-hook (lambda () (setq whitespace-line-column -1))) (add-hook 'LaTeX-mode-hook (lambda () (setq whitespace-line-column -1)))
@ -191,16 +237,19 @@
(add-hook 'LaTeX-mode-hook 'key-latex-mode-setup) (add-hook 'LaTeX-mode-hook 'key-latex-mode-setup)
;; CUSTOM EMACS
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(safe-local-variable-values (quote ((encoding . utf-8))))) '(custom-safe-themes
(quote
("737d9d0e0f6c4279e80f7479ec5138af6e4908a2d052126f254e1e6d1a0d0188" default))))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
) )
(load-theme 'hydandata-light)