Check for hunspell and mutool exe

This commit is contained in:
Marcus Kammer 2024-10-31 16:21:28 +01:00
parent fb75187167
commit cc9d279f0b

35
init.el
View file

@ -157,6 +157,21 @@
(setq doom-themes-enable-bold t
doom-themes-enable-italic t))
(defun mk/exe-available-p (exe-name)
"Check if exe is available on the system."
(cond
;; Check for Windows
((eq system-type 'windows-nt)
(or (executable-find (format "%s.exe" exe-name))
(executable-find exe-name)))
;; Check for Linux and other Unix-like systems
((or (eq system-type 'gnu/linux)
(eq system-type 'darwin)
(eq system-type 'berkeley-unix))
(executable-find exe-name))
;; Return nil for unsupported systems
(t nil)))
;; (load "bundle--gui")
(setq-default mode-line-format
@ -323,6 +338,7 @@
(use-package doc-view
:ensure nil
:init (mk/exe-available-p "mutool")
:custom
(doc-view-continuous nil)
(doc-view-scale-internally nil)
@ -421,22 +437,7 @@
(shrface-trial)
(shrface-default-keybindings))
(defun hunspell-available-p ()
"Check if Hunspell is available on the system."
(cond
;; Check for Windows
((eq system-type 'windows-nt)
(or (executable-find "hunspell.exe")
(executable-find "hunspell")))
;; Check for Linux and other Unix-like systems
((or (eq system-type 'gnu/linux)
(eq system-type 'darwin)
(eq system-type 'berkeley-unix))
(executable-find "hunspell"))
;; Return nil for unsupported systems
(t nil)))
(when (hunspell-available-p)
(when (mk/exe-available-p "hunspell")
(progn
(use-package flyspell
:hook ((LaTeX-mode . flyspell-mode)
@ -446,7 +447,7 @@
(use-package ispell
:ensure nil
:config
;; On windows: Copy *.aff and *.dic files to C:\msys64\ucrt64\share\hunspell
;; On windows: Copy *.aff and *.dic files to C:\msys64\ucrt64\share\hunspell or C:\cygwin64\usr\share\myspell
;; `hunspell -D`, the program will display the dictionaries and affix files it
;; finds and loads.
;; (when (eq system-type 'windows-nt)