Files
memex/projects/dotemacs/modules/emacs-writing.org

1.4 KiB

Emacs Writing Configuration

Spell Checking

  (use-package flyspell
    :config (setq ispell-program-name "hunspell"
                  ispell-default-dictionary "en_US"
                  )
    :diminish (flyspell-mode . "φ")
    :hook (text-mode . flyspell-mode)
    :bind (
           ("M-<f7>" . flyspell-buffer)
           ("<f7>" . flyspell-word)
           ("C-;" . flyspell-auto-correct-previous-word)
           )
    )

Syntax Checking

  (use-package flycheck
    :init (global-flycheck-mode)
    :diminish (flycheck-mode . "")
    :config
    (add-hook 'after-init-hook #'global-flycheck-mode)
    (setq flycheck-emacs-lisp-load-path 'inherit)
    (setq flycheck-emacs-lisp-load-path (concat user-emacs-directory "straight/build"))
    )

Text Manipulation

  (subword-mode)
  (setq sentence-end-double-space nil)

  (defun my/fill-or-unfill-paragraph (&optional unfill region)
    "Fill paragraph (or REGION). With the prefix argument UNFILL, fill it instead."
    (interactive (progn
                   (barf-if-buffer-read-only)
                   (list (if current-prefix-arg 'fill) t)))
    (let ((fill-column (if unfill fill-column (point-max))))
      (fill-paragraph nil region)))

  (bind-key "M-q" 'my/fill-or-unfill-paragraph)

  (add-hook 'text-mode-hook 'turn-on-visual-line-mode)