emacs/elisp/init-syntax.el
2024-05-25 22:49:04 +02:00

118 lines
3.8 KiB
EmacsLisp

;;; init-syntax.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-syntax.el
;; Description: Initialize Flycheck
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Fri Mar 15 10:08:22 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d flycheck flyspell
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes flycheck and flyspell
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;; FlyCheckPac
(use-package flycheck
:defer t
:diminish
:hook (after-init . global-flycheck-mode)
:commands (flycheck-add-mode)
:custom
(flycheck-global-modes
'(not outline-mode diff-mode shell-mode eshell-mode term-mode))
(flycheck-emacs-lisp-load-path 'inherit)
(flycheck-indication-mode (if (display-graphic-p) 'right-fringe 'right-margin))
:init
(if (display-graphic-p)
(use-package flycheck-posframe
:custom-face
(flycheck-posframe-face ((t (:foreground ,(face-foreground 'success)))))
(flycheck-posframe-info-face ((t (:foreground ,(face-foreground 'success)))))
:hook (flycheck-mode . flycheck-posframe-mode)
:custom
(flycheck-posframe-position 'window-bottom-left-corner)
(flycheck-posframe-border-width 3)
(flycheck-posframe-inhibit-functions
'((lambda (&rest _) (bound-and-true-p company-backend)))))
(use-package flycheck-pos-tip
:defines flycheck-pos-tip-timeout
:hook (flycheck-mode . flycheck-pos-tip-mode)
:custom (flycheck-pos-tip-timeout 30)))
:config
(use-package flycheck-popup-tip
:hook (flycheck-mode . flycheck-popup-tip-mode))
(when (fboundp 'define-fringe-bitmap)
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
[16 48 112 240 112 48 16] nil nil 'center))
(when (executable-find "vale")
(use-package flycheck-vale
:config
(flycheck-vale-setup)
(flycheck-add-mode 'vale 'latex-mode))))
;; -FlyCheckPac
;; FlyspellPac
(use-package flyspell
:ensure nil
:bind (("C-c N" . (lambda ()
(interactive)
(ispell-change-dictionary "nl_NL")
(flyspell-buffer)))
("C-c E" . (lambda ()
(interactive)
(ispell-change-dictionary "en_US")
(flyspell-buffer))
))
:diminish
:if (executable-find "hunspell")
:hook (((text-mode outline-mode latex-mode org-mode markdown-mode) . flyspell-mode))
:custom
(flyspell-issue-message-flag nil)
(ispell-program-name "hunspell")
(ispell-dictionary "nl_NL")
:init
(setenv "LANG" "en_US.UTF-8")
(setenv "DICPATH" (concat (file-name-directory user-init-file) "spelling"))
(use-package flyspell-correct-ivy
:after ivy
:bind ("C-M-;" . flyspell-correct-wrapper)
:init
(setq flyspell-correct-interface #'flyspell-correct-ivy))
)
;; -FlyspellPac
(provide 'init-syntax)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-syntax.el ends here