emacs: add julia, spell checking, adapt latex

This commit is contained in:
2022-11-17 15:25:23 +01:00
parent 32eb67ed95
commit aad8888eab
3 changed files with 44 additions and 14 deletions

View File

@ -112,8 +112,8 @@
** TeX
#+begin_src emacs-lisp :tangle yes
(map! :map TeX-mode-map :nvi "<backtab>" #'outline-cycle-buffer)
(map! :map TeX-mode-map :nvi "<tab>" #'outline-cycle)
;; (map! :map TeX-mode-map :nvi "<backtab>" #'outline-cycle-buffer)
;; (map! :map TeX-mode-map :nvi "<tab>" #'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