From 450dfe043e54e94793dc002ae118c6bc3cb27e1d Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Thu, 16 Jun 2022 11:17:54 -0700 Subject: [PATCH] Got write-room, proselint AND textlint working in Org files Created a flycheck chain for all of them. My writing will soon become great! --- ha-org.org | 56 +++++++++++++++++++++++++++++++++++++++++----- ha-programming.org | 12 +++++----- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/ha-org.org b/ha-org.org index 47a2c89..b7b68ff 100644 --- a/ha-org.org +++ b/ha-org.org @@ -696,8 +696,8 @@ Now, let’s connect it to flycheck: ((warning line-start (file-name) ":" line ":" column ":" (message) line-end)) :modes (markdown-mode org-mode text-mode)) - (add-to-list 'flycheck-checkers 'vale 'append)) #+END_SRC + (add-to-list 'flycheck-checkers 'write-good)) *** Proselint With overlapping goals to =write-good=, the [[https://github.com/amperser/proselint/][proselint]] project, once installed, can check for some English phrasings. I like =write-good= better, but I want this available for its level of /pedantic-ness/. #+BEGIN_SRC sh @@ -718,10 +718,55 @@ Next, create a configuration file, =~/.config/proselint/config= file, to turn on And tell [[https://www.flycheck.org/][flycheck]] to use this: #+BEGIN_SRC emacs-lisp (use-package flycheck - :config (add-to-list 'flycheck-checkers 'proselint)) #+END_SRC + :config + (add-to-list 'flycheck-checkers 'proselint) + ;; And create the chain of checkers so that both work: + (flycheck-add-next-checker 'write-good 'proselint)) +#+end_src +*** Textlint +The [[https://textlint.github.io/][textlint]] project comes with =flycheck=, as long as there is an executable: +#+begin_src sh + npm install -g textlint + # And all the rules + npm install -g textlint-rule-alex + npm install -g textlint-rule-diacritics + npm install -g textlint-rule-en-max-word-count + npm install -g textlint-rule-max-comma + npm install -g textlint-rule-no-start-duplicated-conjunction + npm install -g textlint-rule-period-in-list-item + npm install -g textlint-rule-stop-words + npm install -g textlint-rule-terminology + npm install -g textlint-rule-unexpanded-acronym +#+end_src +I create a configuration file in my home directory: +#+begin_src js :tangle ~/.textlintrc +{ + "filters": {}, + "rules": { + "abbr-within-parentheses": false, + "alex": true, + "common-misspellings": false, + "diacritics": true, + "en-max-word-count": true, + "max-comma": true, + "no-start-duplicated-conjunction": true, + "period-in-list-item": true, + "stop-words": true, + "terminology": true, + "unexpanded-acronym": true, + "write-good": false + } +} +#+end_src +Add =textlint= to the /chain/ for Org files: +#+begin_src emacs-lisp + (use-package flycheck + :config + (setq flycheck-textlint-config (format "%s/.textlintrc" (getenv "HOME"))) + (flycheck-add-next-checker 'proselint 'textlint)) ** Distraction-Free Writing -Be inspired after reading [[https://christopherfin.com/writing/emacs-writing.html][Christopher Fin's essay]]. +[[https://christopherfin.com/writing/emacs-writing.html][Christopher Fin's essay]] inspired me to clean my writing room. *** Write-room For a complete focused, /distraction-free/ environment, for writing or concentrating, I'm using [[https://github.com/joostkremers/writeroom-mode][Writeroom-mode]]: @@ -740,8 +785,8 @@ For a complete focused, /distraction-free/ environment, for writing or concentra ("C-M-=" . writeroom-adjust-width))) #+END_SRC *** Olivetti -The [[https://github.com/rnkn/olivetti][olivetti project]] sets wide margins and centers the text. It isn’t better than Writeroom, however, it works well with Logos (below). #+BEGIN_SRC emacs-lisp +The [[https://github.com/rnkn/olivetti][olivetti project]] sets wide margins and centers the text. It isn’t better than Writeroom, but, it works well with Logos (below). (use-package olivetti :init (setq-default olivetti-body-width 100) @@ -764,8 +809,7 @@ Trying out [[https://protesilaos.com/][Protesilaos Stavrou]]’s [[https://prote (org-mode . "^\\*+ +") (t . ,(or outline-regexp logos--page-delimiter)))) - ;; These apply when `logos-focus-mode' is enabled. Their value is - ;; buffer-local. + ;; These apply when enabling `logos-focus-mode' as buffer-local. (setq-default logos-hide-mode-line t logos-scroll-lock nil logos-indicate-buffer-boundaries nil diff --git a/ha-programming.org b/ha-programming.org index 5d1c6b7..29d5f2e 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -50,14 +50,14 @@ Farm off commands into /virtual environments/: (direnv-mode)) #+END_SRC ** Spell Checking Comments -The [[https://www.emacswiki.org/emacs/FlySpell#h5o-2][flyspell-prog-mode]] only checks for misspellings in comments. +The [[https://www.emacswiki.org/emacs/FlySpell#h5o-2][flyspell-prog-mode]] checks for misspellings in comments. #+BEGIN_SRC emacs-lisp (use-package flyspell :hook (prog-mode . flyspell-prog-mode)) #+END_SRC ** Flycheck -Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Speed used to be the advantage, however, I’m now pushing this stuff to LSP, so speed is less of an issue. However, what about when I am not using LSP? Also, since I’ve hooked up grammar stuff to it, I need this with global keybindings. +Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Speed used to be the advantage, but I’m now pushing much of this to LSP, so speed is less of an issue. What about when I am not using LSP? Also, since I’ve hooked grammar checkers, I need this with global keybindings. #+BEGIN_SRC emacs-lisp (use-package flycheck @@ -81,7 +81,9 @@ Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Spe "P b" '("error buffer" . flycheck-buffer) "P c" '("clear" . flycheck-clear) "P n" '("next" . flycheck-next-error) + "P N" '("next" . flycheck-next-error) "P p" '("previous" . flycheck-previous-error) + "P P" '("previous" . flycheck-previous-error) "P l" '("list all" . flycheck-list-errors) "P y" '("copy errors" . flycheck-copy-errors-as-kill) "P s" '("select checker" . flycheck-select-checker) @@ -96,15 +98,13 @@ Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Spe "P t" '("toggle flycheck" . flycheck-mode))) #+END_SRC ** Documentation -I’ve used the [[http://kapeli.com/][Dash]] API Documentation browser (an external application) with Emacs, however, this is only available for Mac. +I’ve used the [[http://kapeli.com/][Dash]] API Documentation browser (an external application) with Emacs, available for Mac. #+BEGIN_SRC emacs-lisp :tangle no (use-package dash-at-point :commands (dash-at-point) :general (:states 'normal "gD" 'dash-at-point)) #+END_SRC -However, I’m interested in using [[https://devdocs.io/][devdocs]] instead, which is similar, but keeps it all /inside/ Emacs (and works on my Linux system). There are seems to be two competing Emacs projects for this. - -The Emacs [[https://github.com/astoff/devdocs.el][devdocs]] project is active, and seems to work well. Its advantage is a special mode for moving around the documentation. +I’m interested in using [[https://devdocs.io/][devdocs]] instead, which is similar, but keeps it all /inside/ Emacs (and works on my Linux system). Two Emacs projects compete for this position. The Emacs [[https://github.com/astoff/devdocs.el][devdocs]] project is active, and seems to work well. Its advantage is a special mode for moving around the documentation. #+BEGIN_SRC emacs-lisp (use-package devdocs