Remove "LanguageTool" and redundant textlint plugin
I really don't want to start a massive Java process just to check grammar, when it appears that using both write-good, proselint and textlint is sufficient.
This commit is contained in:
parent
203ebcc652
commit
1fbe1ee646
2 changed files with 10 additions and 36 deletions
37
ha-org.org
37
ha-org.org
|
|
@ -3,7 +3,7 @@
|
||||||
#+date: 2020-09-18
|
#+date: 2020-09-18
|
||||||
#+tags: emacs org
|
#+tags: emacs org
|
||||||
#+startup: inlineimages
|
#+startup: inlineimages
|
||||||
#+lastmod: [2026-07-15 Wed]
|
#+lastmod: [2026-08-06 Thu]
|
||||||
|
|
||||||
A literate programming file for configuring org-mode and those files.
|
A literate programming file for configuring org-mode and those files.
|
||||||
|
|
||||||
|
|
@ -1042,7 +1042,6 @@ The [[https://textlint.github.io/][textlint]] project comes with =flycheck=, as
|
||||||
sudo npm install -g textlint-rule-max-comma
|
sudo npm install -g textlint-rule-max-comma
|
||||||
sudo npm install -g textlint-rule-no-start-duplicated-conjunction
|
sudo npm install -g textlint-rule-no-start-duplicated-conjunction
|
||||||
sudo npm install -g textlint-rule-period-in-list-item
|
sudo npm install -g textlint-rule-period-in-list-item
|
||||||
sudo npm install -g textlint-rule-stop-words
|
|
||||||
sudo npm install -g textlint-rule-terminology
|
sudo npm install -g textlint-rule-terminology
|
||||||
sudo npm install -g textlint-rule-unexpanded-acronym
|
sudo npm install -g textlint-rule-unexpanded-acronym
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -1059,7 +1058,7 @@ I create a configuration file in my home directory:
|
||||||
"max-comma": true,
|
"max-comma": true,
|
||||||
"no-start-duplicated-conjunction": true,
|
"no-start-duplicated-conjunction": true,
|
||||||
"period-in-list-item": true,
|
"period-in-list-item": true,
|
||||||
"stop-words": true,
|
"stop-words": false,
|
||||||
"terminology": true,
|
"terminology": true,
|
||||||
"unexpanded-acronym": true,
|
"unexpanded-acronym": true,
|
||||||
"write-good": false
|
"write-good": false
|
||||||
|
|
@ -1075,38 +1074,6 @@ Add =textlint= to the /chain/ for Org files:
|
||||||
(flycheck-add-next-checker 'proselint 'textlint t))
|
(flycheck-add-next-checker 'proselint 'textlint t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Language Tool
|
|
||||||
Another flycheck feature is to use [[http://languagetool.org][LanguageTool]] connection to [[https://github.com/emacs-languagetool/flycheck-languagetool][flycheck-languagetool]]:
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle no
|
|
||||||
(use-package flycheck-languagetool
|
|
||||||
:ensure t
|
|
||||||
:hook (text-mode . flycheck-languagetool-setup)
|
|
||||||
:init
|
|
||||||
(setq flycheck-languagetool-server-jar (expand-file-name "/opt/homebrew/Cellar/languagetool/6.6/libexec/languagetool-commandline.jar")
|
|
||||||
flycheck-languagetool-server-args (expand-file-name "~/.config/languagetool/config.properties")))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Where it can read: [[file:~/.config/languagetool/config.properties][config.properties]].
|
|
||||||
|
|
||||||
And connect it to the chain:
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle no
|
|
||||||
(use-package flycheck
|
|
||||||
:config (flycheck-add-next-checker 'textlint 'languagetool t)
|
|
||||||
|
|
||||||
;; May have to specify a Java on one of my Mac machines:
|
|
||||||
(when (file-exists-p "/opt/homebrew/opt/openjdk")
|
|
||||||
(add-to-list 'exec-path "/opt/homebrew/opt/openjdk/bin")))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
This check complains about whitespace in Org files (duh), so let’s create a configuration file where we can disable that rule (and any other we can require):
|
|
||||||
|
|
||||||
#+BEGIN_SRC conf :tangle ~/.config/languagetool/config.properties :mkdirp ~/.config/languagetool
|
|
||||||
disabledRuleIds: WHITESPACE
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Gotta admit that Language Tool doesn’t seem to help much. $ 100 ?
|
|
||||||
** Perfect Sentence
|
** Perfect Sentence
|
||||||
Chris Malorana’s [[https://www.youtube.com/watch?v=E-yk_V5TnNU][video tutorial]] demonstrates the ability to extrude a single sentence into another buffer, edit different versions of that sentence, and replace one version into the original buffer. For instance, how org-mode edits blocks.
|
Chris Malorana’s [[https://www.youtube.com/watch?v=E-yk_V5TnNU][video tutorial]] demonstrates the ability to extrude a single sentence into another buffer, edit different versions of that sentence, and replace one version into the original buffer. For instance, how org-mode edits blocks.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1374,13 +1374,20 @@ Note that =flycheck-define-checker= only /defines/ the checker; the =add-to-list
|
||||||
(add-to-list 'flycheck-checkers 'markdown-remark t)
|
(add-to-list 'flycheck-checkers 'markdown-remark t)
|
||||||
|
|
||||||
;; Structure first, then prose, in one report.
|
;; Structure first, then prose, in one report.
|
||||||
(flycheck-add-next-checker 'markdown-pymarkdown 'markdown-remark))
|
(flycheck-add-next-checker 'markdown-pymarkdown 'markdown-remark)
|
||||||
|
|
||||||
|
;; Then terminology/consistency, since flycheck's built-in textlint
|
||||||
|
;; checker already declares markdown-mode/gfm-mode and picks the
|
||||||
|
;; @textlint/markdown plugin for them -- no new checker needed.
|
||||||
|
(flycheck-add-next-checker 'markdown-remark 'textlint t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Naming =markdown-remark= as a plain symbol, rather than a =(level . checker)= cons cell, means the prose check runs whatever PyMarkdown found. Were it written =(warning . markdown-remark)=, a single formatting error would swallow the prose report along with it.
|
Naming =markdown-remark= as a plain symbol, rather than a =(level . checker)= cons cell, means the prose check runs whatever PyMarkdown found. Were it written =(warning . markdown-remark)=, a single formatting error would swallow the prose report along with it.
|
||||||
|
|
||||||
Since remark now runs =write-good= over the prose (and more carefully, as it skips the code), the [[file:ha-org.org::*Writegood][write-good]] checker no longer lists =markdown-mode= among its modes, and the two do not double up.
|
Since remark now runs =write-good= over the prose (and more carefully, as it skips the code), the [[file:ha-org.org::*Writegood][write-good]] checker no longer lists =markdown-mode= among its modes, and the two do not double up.
|
||||||
|
|
||||||
|
[[file:ha-org.org::*Textlint][Textlint]] runs last in the chain. Its bundled Markdown plugin parses the AST itself, so it skips fenced code without any =ignore-code.js=-style help, and =flycheck-textlint-plugin-alist= already maps =markdown-mode=/=gfm-mode= to =@textlint/markdown=.
|
||||||
|
|
||||||
*** Markdown and Polymode
|
*** Markdown and Polymode
|
||||||
Using [[https://polymode.github.io/][polymode]], let’s add syntax coloring to Markdown code blocks similar to what we do with Org:
|
Using [[https://polymode.github.io/][polymode]], let’s add syntax coloring to Markdown code blocks similar to what we do with Org:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue