From aad8888eab002f9ac465bc94dc5a8ad21ca9b156 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Thu, 17 Nov 2022 15:25:23 +0100 Subject: [PATCH] emacs: add julia, spell checking, adapt latex --- emacs/doom/config.org | 45 +++++++++++++++++++++++++++++++++---------- emacs/doom/init.el | 7 ++++--- zsh/.zshrc | 6 +++++- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/emacs/doom/config.org b/emacs/doom/config.org index 0da2b5b..8a68214 100644 --- a/emacs/doom/config.org +++ b/emacs/doom/config.org @@ -112,8 +112,8 @@ ** TeX #+begin_src emacs-lisp :tangle yes -(map! :map TeX-mode-map :nvi "" #'outline-cycle-buffer) -(map! :map TeX-mode-map :nvi "" #'outline-cycle) +;; (map! :map TeX-mode-map :nvi "" #'outline-cycle-buffer) +;; (map! :map TeX-mode-map :nvi "" #'outline-cycle) (map! :map TeX-mode-map :nvi "C-k" #'outline-backward-same-level) (map! :map TeX-mode-map :nvi "C-j" #'outline-forward-same-level) (map! :map TeX-mode-map :nvi "C-h" #'outline-up-heading) @@ -124,15 +124,17 @@ (use-package! langtool-ignore-fonts :config (langtool-ignore-fonts-add 'latex-mode '(font-lock-comment-face - ;; font-latex-math-face - ;; font-latex-string-face - font-lock-keyword-face - font-lock-constant-face - font-lock-function-name-face - font-lock-variable-name-face - ;; font-lock-type-face ;; figure captions - ))) + ;; font-latex-math-face + ;; font-latex-string-face + font-lock-keyword-face + font-lock-constant-face + font-lock-function-name-face + font-lock-variable-name-face + font-lock-type-face ;; figure captions + ))) +;; Fixes latexindent not finding perl libraries +(setenv "PERL5LIB" "/home/julian/perl5/lib/perl5") #+end_src ** Spell Checking @@ -167,6 +169,29 @@ (ispell-change-dictionary change) (message "Dictionary switched from %s to %s" dic change) )) + +(set-flyspell-predicate! '(latex-mode) + #'+latex-flyspell-word-p) + +(defun +latex-flyspell-word-p () + "Return t if point is on a word that should be spell checked. + +Return nil if on a link url, markup, html, or references." + (let ((faces (ensure-list (get-text-property (point) 'face)))) + (or (and (memq 'font-lock-comment-face faces) + (memq 'markdown-code-face faces)) + (not (cl-loop with unsafe-faces = '(font-lock-comment-face + ;; font-latex-math-face + ;; font-latex-string-face + font-lock-keyword-face + font-lock-constant-face + font-lock-function-name-face + font-lock-variable-name-face + font-lock-type-face ;; figure captions + ) + for face in faces + if (memq face unsafe-faces) + return t))))) #+end_src ** Flutter diff --git a/emacs/doom/init.el b/emacs/doom/init.el index c7a01e7..1a5b638 100644 --- a/emacs/doom/init.el +++ b/emacs/doom/init.el @@ -81,7 +81,7 @@ :checkers syntax ; tasing you for every semicolon you forget - (spell +flyspell +everywhere) ; tasing you for misspelling mispelling + (spell +flyspell +aspell +everywhere) ; tasing you for misspelling mispelling grammar ; tasing grammar mistake every you make :tools @@ -106,6 +106,7 @@ ;;terraform ; infrastructure as code ;;tmux ; an API for interacting with tmux ;;upload ; map local to remote projects via ssh/ftp + tree-sitter :os (:if IS-MAC macos) ; improve compatibility with macOS @@ -127,7 +128,7 @@ ;;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses ;;erlang ; an elegant language for a more civilized age - ;;ess ; emacs speaks statistics + ess ; emacs speaks statistics ;;factor ;;faust ; dsp, but you get to keep your soul ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) @@ -142,7 +143,7 @@ json ; At least it ain't XML ;;(java +lsp) ; the poster child for carpal tunnel syndrome ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) - ;;julia ; a better, faster MATLAB + (julia +lsp +tree-sitter) ; a better, faster MATLAB ;;kotlin ; a better, slicker Java(Script) (latex) ; writing papers in Emacs has never been so fun ;;lean ; for folks with too much to prove diff --git a/zsh/.zshrc b/zsh/.zshrc index e776f6a..92190f4 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -5,6 +5,11 @@ export PATH=/home/julian/.cargo/bin:$PATH export PATH=/home/julian/perl5/bin:$PATH [ -f "/home/julian/.ghcup/env" ] && source "/home/julian/.ghcup/env" # ghcup-env +PERL5LIB="/home/julian/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; +PERL_LOCAL_LIB_ROOT="/home/julian/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; +PERL_MB_OPT="--install_base \"/home/julian/perl5\""; export PERL_MB_OPT; +PERL_MM_OPT="INSTALL_BASE=/home/julian/perl5"; export PERL_MM_OPT; + # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" @@ -109,4 +114,3 @@ follow_du () { } eval "$(starship init zsh)" -