Replace :app write with :checkers grammar
This commit is contained in:
parent
8ac4320e0b
commit
a680a4c96d
9 changed files with 104 additions and 250 deletions
|
@ -76,6 +76,9 @@
|
||||||
;;term ; terminals in Emacs
|
;;term ; terminals in Emacs
|
||||||
;;vterm ; another terminals in Emacs
|
;;vterm ; another terminals in Emacs
|
||||||
|
|
||||||
|
:checkers
|
||||||
|
;;grammar
|
||||||
|
|
||||||
:tools
|
:tools
|
||||||
;;ansible
|
;;ansible
|
||||||
;;debugger ; FIXME stepping through code, to help you add bugs
|
;;debugger ; FIXME stepping through code, to help you add bugs
|
||||||
|
@ -171,7 +174,6 @@
|
||||||
;;irc ; how neckbeards socialize
|
;;irc ; how neckbeards socialize
|
||||||
;;(rss +org) ; emacs as an RSS reader
|
;;(rss +org) ; emacs as an RSS reader
|
||||||
;;twitter ; twitter client https://twitter.com/vnought
|
;;twitter ; twitter client https://twitter.com/vnought
|
||||||
;;write ; emacs for writers (fiction, notes, papers, etc.)
|
|
||||||
|
|
||||||
:config
|
:config
|
||||||
;;literate
|
;;literate
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
#+TITLE: app/write
|
|
||||||
#+DATE: October 10, 2019
|
|
||||||
#+SINCE: v1.3
|
|
||||||
#+STARTUP: inlineimages
|
|
||||||
|
|
||||||
* Table of Contents :TOC_3:noexport:
|
|
||||||
- [[#description][Description]]
|
|
||||||
- [[#module-flags][Module Flags]]
|
|
||||||
- [[#plugins][Plugins]]
|
|
||||||
- [[#prerequisites][Prerequisites]]
|
|
||||||
- [[#language-tool][Language Tool]]
|
|
||||||
- [[#wordnut][Wordnut]]
|
|
||||||
- [[#features][Features]]
|
|
||||||
- [[#m-x-write-mode][~M-x +write-mode~]]
|
|
||||||
- [[#language-tool-langtool][Language Tool ~+langtool~]]
|
|
||||||
- [[#commands][Commands]]
|
|
||||||
- [[#wordnut-wordnut][Wordnut ~+wordnut~]]
|
|
||||||
- [[#commands-1][Commands]]
|
|
||||||
- [[#synosaurus][Synosaurus]]
|
|
||||||
- [[#commands-2][Commands]]
|
|
||||||
- [[#configuration][Configuration]]
|
|
||||||
- [[#mixed-pitch-mode][mixed-pitch-mode]]
|
|
||||||
- [[#appendix][Appendix]]
|
|
||||||
- [[#minor-modes][Minor modes]]
|
|
||||||
- [[#commands-3][Commands]]
|
|
||||||
|
|
||||||
* Description
|
|
||||||
Adds word processing tools and the ~+write-mode~ minor mode, which converts
|
|
||||||
Emacs into a more comfortable writing environment.
|
|
||||||
|
|
||||||
** Module Flags
|
|
||||||
This module provides two module flags:
|
|
||||||
|
|
||||||
- ~+langtool~ Enables language tool integration.
|
|
||||||
- ~+wordnut~ Enables wordnet integration.
|
|
||||||
|
|
||||||
** Plugins
|
|
||||||
+ [[https://github.com/hpdeifel/synosaurus][synosaurus]]
|
|
||||||
+ [[https://gitlab.com/jabranham/mixed-pitch][mixed-pitch]]
|
|
||||||
+ [[https://github.com/joostkremers/visual-fill-column][visual-fill-column]]
|
|
||||||
+ [[https://github.com/mhayashi1120/Emacs-langtool][langtool]]* (=+langtool=)
|
|
||||||
+ [[https://github.com/gromnitsky/wordnut][wordnut]]* (=+wordnut=)
|
|
||||||
|
|
||||||
* Prerequisites
|
|
||||||
** Language Tool
|
|
||||||
Either download and deploy it from https://languagetool.org/ or install it
|
|
||||||
through your OS package manager:
|
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
|
||||||
# MacOS/Homebrew users:
|
|
||||||
brew install languagetool
|
|
||||||
|
|
||||||
# Arch Linux users:
|
|
||||||
sudo pacman -S languagetool
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
This module tries to guess the location of languagetool-commandline.jar. If you
|
|
||||||
get a warning that Doom =couldn't find languagetool-commandline.jar=, you will
|
|
||||||
need to find langaugetool-commandline.jar and set ~langtool-language-tool-jar~
|
|
||||||
to its path.
|
|
||||||
|
|
||||||
** Wordnut
|
|
||||||
This requires =wordnet= to be installed, which should be available through your
|
|
||||||
OS package manager:
|
|
||||||
|
|
||||||
#+BEGIN_SRC sh
|
|
||||||
# MacOS/Homebrew users:
|
|
||||||
brew install wordnet
|
|
||||||
|
|
||||||
# Arch Linux users:
|
|
||||||
sudo pacaur -S wordnet # on the AUR
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Features
|
|
||||||
** ~M-x +write-mode~
|
|
||||||
Write mode makes Emacs a more comfortable writing environment by:
|
|
||||||
|
|
||||||
- Centering the buffer (with ~visual-fill-column-mode~), ala distraction-free
|
|
||||||
mode from other text editors.
|
|
||||||
- Soft-wrapping long text lines with ~visual-line-mode~.
|
|
||||||
- Enabling ~mixed-pitch-mode~, allowing fixed-width and variable-pitch fonts to
|
|
||||||
co-exist in one buffer. For example, a monospace font for SRC blocks and Arial
|
|
||||||
for everything else.
|
|
||||||
- In org-mode:
|
|
||||||
- Turns on ~org-indent-mode~
|
|
||||||
- Turns on ~+org-pretty-mode~
|
|
||||||
|
|
||||||
** Language Tool ~+langtool~
|
|
||||||
[[https://www.languagetool.org/][Language Tool]] is a polyglot proofreader service that checks for grammar and
|
|
||||||
stylistic issues in your writing. This requires Java 1.8+.
|
|
||||||
|
|
||||||
#+begin_quote
|
|
||||||
This requires Java 1.8+
|
|
||||||
#+end_quote
|
|
||||||
|
|
||||||
*** Commands
|
|
||||||
- ~langtool-check~
|
|
||||||
- ~langtool-correct-buffer~
|
|
||||||
|
|
||||||
** Wordnut ~+wordnut~
|
|
||||||
Wordnut provides a searchable dictionary frontend for Emacs. This requires
|
|
||||||
~wordnet~, which should be available in your OS's package manager.
|
|
||||||
|
|
||||||
*** Commands
|
|
||||||
- ~wordnut-search~
|
|
||||||
- ~wordnut-lookup-curent-word~
|
|
||||||
|
|
||||||
** Synosaurus
|
|
||||||
Synosaurus provides a service for looking up synonyms. It requires an internet
|
|
||||||
connection.
|
|
||||||
|
|
||||||
*** Commands
|
|
||||||
- ~synosaurus-lookup~
|
|
||||||
- ~synosaurus-choose-and-replace~
|
|
||||||
|
|
||||||
* Configuration
|
|
||||||
** mixed-pitch-mode
|
|
||||||
To configure which faces are displayed with fixed-pitch fonts in
|
|
||||||
~mixed-pitch-mode~, look into ~mixed-pitch-fixed-pitch-faces~.
|
|
||||||
|
|
||||||
* Appendix
|
|
||||||
** Minor modes
|
|
||||||
- ~+write-mode~
|
|
||||||
- ~mixed-pitch-mode~
|
|
||||||
** Commands
|
|
||||||
- ~langtool-check~
|
|
||||||
- ~langtool-correct-buffer~
|
|
||||||
- ~synosaurus-choose-and-replace~
|
|
||||||
- ~synosaurus-lookup~
|
|
||||||
- ~wordnut-lookup-curent-word~
|
|
||||||
- ~wordnut-search~
|
|
|
@ -1,43 +0,0 @@
|
||||||
;;; app/write/autoload.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defvar +write-mode-map (make-sparse-keymap)
|
|
||||||
"TODO")
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(define-minor-mode +write-mode
|
|
||||||
"Turns Emacs into a more comfortable writing environment and word processor."
|
|
||||||
:init-value nil
|
|
||||||
:keymap +write-mode-map
|
|
||||||
(setq-local visual-fill-column-center-text t)
|
|
||||||
(when +write-text-scale
|
|
||||||
(text-scale-set (if +write-mode 2 0)))
|
|
||||||
(when +write-line-spacing
|
|
||||||
(setq-local line-spacing +write-line-spacing)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +write-init-org-mode-h ()
|
|
||||||
"Initializes `org-mode' specific settings for `+write-mode'."
|
|
||||||
(when (eq major-mode 'org-mode)
|
|
||||||
(+org-pretty-mode (if +write-mode +1 -1))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +write-init-line-numbers-h ()
|
|
||||||
(display-line-numbers-mode (if +write-mode +1 -1)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +write-init-mixed-pitch-h ()
|
|
||||||
(mixed-pitch-mode (if +write-mode +1 -1)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +write-init-visual-fill-column-h ()
|
|
||||||
(visual-fill-column-mode (if +write-mode +1 -1)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(add-hook! '+write-mode-hook
|
|
||||||
#'(flyspell-mode
|
|
||||||
visual-line-mode
|
|
||||||
+write-init-mixed-pitch-h
|
|
||||||
+write-init-visual-fill-column-h
|
|
||||||
+write-init-line-numbers-h
|
|
||||||
+write-init-org-mode-h))
|
|
|
@ -1,56 +0,0 @@
|
||||||
;;; app/write/config.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
(defvar +write-text-scale nil
|
|
||||||
"What to scale the text up to in `+write-mode'. Uses `text-scale-set'.")
|
|
||||||
|
|
||||||
(defvar +write-line-spacing nil
|
|
||||||
"What to set `line-spacing' in `+write-mode'.")
|
|
||||||
|
|
||||||
;;
|
|
||||||
;; Packages
|
|
||||||
|
|
||||||
(use-package! langtool
|
|
||||||
:when (featurep! +langtool)
|
|
||||||
:commands (langtool-check
|
|
||||||
langtool-check-done
|
|
||||||
langtool-show-message-at-point
|
|
||||||
langtool-correct-buffer)
|
|
||||||
:init (setq langtool-default-language "en-US")
|
|
||||||
:config
|
|
||||||
(unless langtool-language-tool-jar
|
|
||||||
(setq langtool-language-tool-jar
|
|
||||||
(cond (IS-MAC
|
|
||||||
(locate-file "libexec/languagetool-commandline.jar"
|
|
||||||
(doom-files-in "/usr/local/Cellar/languagetool"
|
|
||||||
:type 'dirs
|
|
||||||
:depth 2)))
|
|
||||||
(IS-LINUX
|
|
||||||
"/usr/share/java/languagetool/languagetool-commandline.jar")))))
|
|
||||||
|
|
||||||
|
|
||||||
;; `synosaurus'
|
|
||||||
(setq synosaurus-choose-method 'default)
|
|
||||||
|
|
||||||
|
|
||||||
;; `mixed-pitch'
|
|
||||||
(after! mixed-pitch
|
|
||||||
(setq mixed-pitch-fixed-pitch-faces
|
|
||||||
(append mixed-pitch-fixed-pitch-faces
|
|
||||||
'(org-todo-keyword-todo
|
|
||||||
org-todo-keyword-habt
|
|
||||||
org-todo-keyword-done
|
|
||||||
org-todo-keyword-wait
|
|
||||||
org-todo-keyword-kill
|
|
||||||
org-todo-keyword-outd
|
|
||||||
org-todo
|
|
||||||
org-indent
|
|
||||||
line-number
|
|
||||||
line-number-current-line
|
|
||||||
org-special-keyword
|
|
||||||
org-date
|
|
||||||
org-property-value
|
|
||||||
org-special-keyword
|
|
||||||
org-property-value
|
|
||||||
org-ref-cite-face
|
|
||||||
org-tag
|
|
||||||
font-lock-comment-face))))
|
|
|
@ -1,7 +0,0 @@
|
||||||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
|
||||||
;;; app/write/doctor.el
|
|
||||||
|
|
||||||
(when (featurep! +langtool)
|
|
||||||
(require 'langtool)
|
|
||||||
(unless (file-exists-p langtool-language-tool-jar)
|
|
||||||
(warn! "Couldn't find languagetool-commandline.jar")))
|
|
|
@ -1,12 +0,0 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
|
||||||
;;; app/write/packages.el
|
|
||||||
|
|
||||||
(package! synosaurus)
|
|
||||||
(package! mixed-pitch)
|
|
||||||
|
|
||||||
(when (featurep! +langtool)
|
|
||||||
(package! langtool))
|
|
||||||
(when (featurep! +wordnut)
|
|
||||||
(package! wordnut))
|
|
||||||
|
|
||||||
(package! visual-fill-column)
|
|
68
modules/checkers/grammar/README.org
Normal file
68
modules/checkers/grammar/README.org
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
#+TITLE: checkers/grammar
|
||||||
|
#+DATE: January 9, 2020
|
||||||
|
#+SINCE: v3.0.0
|
||||||
|
#+STARTUP: inlineimages nofold
|
||||||
|
|
||||||
|
* Table of Contents :TOC_3:noexport:
|
||||||
|
- [[#description][Description]]
|
||||||
|
- [[#maintainers][Maintainers]]
|
||||||
|
- [[#module-flags][Module Flags]]
|
||||||
|
- [[#plugins][Plugins]]
|
||||||
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#features][Features]]
|
||||||
|
- [[#language-tool][Language Tool]]
|
||||||
|
- [[#commands][Commands]]
|
||||||
|
- [[#writegood-mode][writegood-mode]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
|
* Description
|
||||||
|
This module adds grammar checking to Emacs to aid your writing by combining
|
||||||
|
=lang-tool= and =writegood-mode=.
|
||||||
|
|
||||||
|
** Maintainers
|
||||||
|
This module has no dedicated maintainers.
|
||||||
|
|
||||||
|
** Module Flags
|
||||||
|
This module provides no flags.
|
||||||
|
|
||||||
|
** Plugins
|
||||||
|
+ [[https://github.com/mhayashi1120/Emacs-langtool][langtool]]
|
||||||
|
+ [[https://github.com/bnbeckwith/writegood-mode][writegood-mode]]
|
||||||
|
|
||||||
|
* Prerequisites
|
||||||
|
This module requires langtool (which requires =Java 1.8+=).
|
||||||
|
|
||||||
|
It can be acquired either from https://languagetool.org/ or your OS's package
|
||||||
|
manager:
|
||||||
|
|
||||||
|
+ macOS: ~brew install languagetool~
|
||||||
|
+ Arch Linux: ~pacman -S languagetool~
|
||||||
|
|
||||||
|
This module tries to guess the location of languagetool-commandline.jar. If you
|
||||||
|
get a warning that Doom =couldn't find languagetool-commandline.jar=, you will
|
||||||
|
need to set ~langtool-language-tool-jar~ to its location.
|
||||||
|
|
||||||
|
* Features
|
||||||
|
An in-depth list of features, how to use them, and their dependencies.
|
||||||
|
|
||||||
|
** Language Tool
|
||||||
|
[[https://www.languagetool.org/][Language Tool]] is a polyglot proofreader service that checks for grammar and
|
||||||
|
stylistic issues in your writing. This requires Java 1.8+.
|
||||||
|
|
||||||
|
#+begin_quote
|
||||||
|
This requires Java 1.8+
|
||||||
|
#+end_quote
|
||||||
|
|
||||||
|
*** Commands
|
||||||
|
- ~langtool-check~
|
||||||
|
- ~langtool-correct-buffer~
|
||||||
|
|
||||||
|
** writegood-mode
|
||||||
|
This minor mode highlights weasel words, duplication and passive voice.
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
How to configure this module, including common problems and how to address them.
|
||||||
|
|
||||||
|
* Troubleshooting
|
||||||
|
Common issues and their solution, or places to look for help.
|
28
modules/checkers/grammar/config.el
Normal file
28
modules/checkers/grammar/config.el
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
;;; checkers/grammar/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(use-package! langtool
|
||||||
|
:commands (langtool-check
|
||||||
|
langtool-check-done
|
||||||
|
langtool-show-message-at-point
|
||||||
|
langtool-correct-buffer)
|
||||||
|
:init (setq langtool-default-language "en-US")
|
||||||
|
:config
|
||||||
|
(unless langtool-language-tool-jar
|
||||||
|
(setq langtool-language-tool-jar
|
||||||
|
(cond (IS-MAC
|
||||||
|
(locate-file "libexec/languagetool-commandline.jar"
|
||||||
|
(doom-files-in "/usr/local/Cellar/languagetool"
|
||||||
|
:type 'dirs
|
||||||
|
:depth 2)))
|
||||||
|
(IS-LINUX
|
||||||
|
"/usr/share/java/languagetool/languagetool-commandline.jar")))))
|
||||||
|
|
||||||
|
|
||||||
|
;; Detects weasel words, passive voice and duplicates
|
||||||
|
(use-package! writegood-mode
|
||||||
|
:hook (org-mode markdown-mode rst-mode asciidoc-mode latex-mode)
|
||||||
|
:config
|
||||||
|
(map! :localleader
|
||||||
|
:map writegood-mode-map
|
||||||
|
"g" #'writegood-grade-level
|
||||||
|
"r" #'writegood-reading-ease))
|
5
modules/checkers/grammar/packages.el
Normal file
5
modules/checkers/grammar/packages.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
;; -*- no-byte-compile: t; -*-
|
||||||
|
;;; checkers/grammar/packages.el
|
||||||
|
|
||||||
|
(package! langtool)
|
||||||
|
(package! writegood-mode)
|
Loading…
Add table
Add a link
Reference in a new issue