Archived
1
0
Fork 0

re-enable flyspell with helm integration

This commit is contained in:
KemoNine 2022-08-25 20:05:52 -04:00
parent dfa675b014
commit dbfc184f0b

View file

@ -395,40 +395,53 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; flyspell ; flyspell
;(require 'flyspell) (require 'flyspell)
;(setenv "LANG" "en_US") (setenv "LANG" "en_US")
;(setenv "DICPATH" "~/.emacs.d.profiles/common/dictionaries") ; https://github.com/wooorm/dictionaries (setq ispell-program-name "hunspell")
;(setq ispell-program-name "hunspell") (setq ispell-dictionary "en_US")
;(setq ispell-dictionary "en_US") (use-package flyspell :demand t
; :config
;(global-set-key (kbd "C-c y") 'flyspell-toggle ) (use-package
; flyspell-correct-helm)
;(defun flyspell-on-for-buffer-type () (defun flyspellCompletion()
; "Enable Flyspell appropriately for the major mode of the current buffer. Uses `flyspell-prog-mode' for modes derived from `prog-mode', so only strings and comments get checked. All other buffers get `flyspell-mode' to check all text. If flyspell is already enabled, does nothing." (flyspell-mode 1)
; (interactive) (set (make-local-variable 'company-backends)
; (if (not (symbol-value flyspell-mode)) ; if not already on (copy-tree company-backends))
; (progn (add-to-list 'company-backends 'company-ispell))
; (if (derived-mode-p 'prog-mode) (defun flyspell-most-modes()
; (progn (add-hook 'text-mode-hook 'flyspellCompletion)
; (message "Flyspell on (code)") (add-hook 'prog-mode-hook 'flyspellCompletion)
; (flyspell-prog-mode)) (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
; ;; else (add-hook hook (lambda ()
; (progn (flyspell-mode -1)))))
; (message "Flyspell on (text)") (flyspell-most-modes)
; (flyspell-mode 1))) )
; ;; I tried putting (flyspell-buffer) here but it didn't seem to work
; ))) (defun flyspell-on-for-buffer-type ()
; "Enable Flyspell appropriately for the major mode of the current buffer. Uses `flyspell-prog-mode' for modes derived from `prog-mode', so only strings and comments get checked. All other buffers get `flyspell-mode' to check all text. If flyspell is already enabled, does nothing."
; (defun flyspell-toggle () (interactive)
; "Turn Flyspell on if it is off, or off if it is on. When turning on, it uses `flyspell-on-for-buffer-type' so code-vs-text is handled appropriately." (if (not (symbol-value flyspell-mode)) ; if not already on
; (interactive) (progn
; (if (symbol-value flyspell-mode) (if (derived-mode-p 'prog-mode)
; (progn ; flyspell is on, turn it off (progn
; (message "Flyspell off") (message "Flyspell on (code)")
; (flyspell-mode -1)) (flyspell-prog-mode))
; ; else - flyspell is off, turn it on ;; else
; (flyspell-on-for-buffer-type))) (progn
; (message "Flyspell on (text)")
;(add-hook 'find-file-hook 'flyspell-on-for-buffer-type) (flyspell-mode 1)))
;(add-hook 'text-mode-hook 'flyspell-on-for-buffer-type) ;; I tried putting (flyspell-buffer) here but it didn't seem to work
;(add-hook 'after-change-major-mode-hook 'flyspell-on-for-buffer-type) )))
(defun flyspell-toggle ()
"Turn Flyspell on if it is off, or off if it is on. When turning on, it uses `flyspell-on-for-buffer-type' so code-vs-text is handled appropriately."
(interactive)
(if (symbol-value flyspell-mode)
(progn ; flyspell is on, t it off
(message "Flyspell off")
(flyspell-mode -1))
; else - flyspell is off, turn it on
(flyspell-on-for-buffer-type)))
; flyspell keyboard shortcuts
(global-set-key (kbd "C-x y") 'flyspell-toggle)
(global-set-key (kbd "C-x w") 'flyspell-correct-wrapper)