Got write-room, proselint AND textlint working in Org files

Created a flycheck chain for all of them. My writing will soon become great!
This commit is contained in:
Howard Abrams 2022-06-16 11:17:54 -07:00
parent 531f73365e
commit 450dfe043e
2 changed files with 56 additions and 12 deletions

View file

@ -696,8 +696,8 @@ Now, lets connect it to flycheck:
((warning line-start (file-name) ":" line ":" column ":" (message) line-end)) ((warning line-start (file-name) ":" line ":" column ":" (message) line-end))
:modes (markdown-mode org-mode text-mode)) :modes (markdown-mode org-mode text-mode))
(add-to-list 'flycheck-checkers 'vale 'append))
#+END_SRC #+END_SRC
(add-to-list 'flycheck-checkers 'write-good))
*** Proselint *** 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/. 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 #+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: And tell [[https://www.flycheck.org/][flycheck]] to use this:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package flycheck (use-package flycheck
:config (add-to-list 'flycheck-checkers 'proselint))
#+END_SRC #+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 ** 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 *** Write-room
For a complete focused, /distraction-free/ environment, for writing or concentrating, I'm using [[https://github.com/joostkremers/writeroom-mode][Writeroom-mode]]: 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))) ("C-M-=" . writeroom-adjust-width)))
#+END_SRC #+END_SRC
*** Olivetti *** Olivetti
The [[https://github.com/rnkn/olivetti][olivetti project]] sets wide margins and centers the text. It isnt better than Writeroom, however, it works well with Logos (below).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
The [[https://github.com/rnkn/olivetti][olivetti project]] sets wide margins and centers the text. It isnt better than Writeroom, but, it works well with Logos (below).
(use-package olivetti (use-package olivetti
:init :init
(setq-default olivetti-body-width 100) (setq-default olivetti-body-width 100)
@ -764,8 +809,7 @@ Trying out [[https://protesilaos.com/][Protesilaos Stavrou]]s [[https://prote
(org-mode . "^\\*+ +") (org-mode . "^\\*+ +")
(t . ,(or outline-regexp logos--page-delimiter)))) (t . ,(or outline-regexp logos--page-delimiter))))
;; These apply when `logos-focus-mode' is enabled. Their value is ;; These apply when enabling `logos-focus-mode' as buffer-local.
;; buffer-local.
(setq-default logos-hide-mode-line t (setq-default logos-hide-mode-line t
logos-scroll-lock nil logos-scroll-lock nil
logos-indicate-buffer-boundaries nil logos-indicate-buffer-boundaries nil

View file

@ -50,14 +50,14 @@ Farm off commands into /virtual environments/:
(direnv-mode)) (direnv-mode))
#+END_SRC #+END_SRC
** Spell Checking Comments ** 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 #+BEGIN_SRC emacs-lisp
(use-package flyspell (use-package flyspell
:hook (prog-mode . flyspell-prog-mode)) :hook (prog-mode . flyspell-prog-mode))
#+END_SRC #+END_SRC
** Flycheck ** Flycheck
Why use [[https://www.flycheck.org/][flycheck]] over the built-in =flymake=? Speed used to be the advantage, however, Im now pushing this stuff to LSP, so speed is less of an issue. However, what about when I am not using LSP? Also, since Ive 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 Im now pushing much of this to LSP, so speed is less of an issue. What about when I am not using LSP? Also, since Ive hooked grammar checkers, I need this with global keybindings.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package flycheck (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 b" '("error buffer" . flycheck-buffer)
"P c" '("clear" . flycheck-clear) "P c" '("clear" . flycheck-clear)
"P n" '("next" . flycheck-next-error) "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 P" '("previous" . flycheck-previous-error)
"P l" '("list all" . flycheck-list-errors) "P l" '("list all" . flycheck-list-errors)
"P y" '("copy errors" . flycheck-copy-errors-as-kill) "P y" '("copy errors" . flycheck-copy-errors-as-kill)
"P s" '("select checker" . flycheck-select-checker) "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))) "P t" '("toggle flycheck" . flycheck-mode)))
#+END_SRC #+END_SRC
** Documentation ** Documentation
Ive used the [[http://kapeli.com/][Dash]] API Documentation browser (an external application) with Emacs, however, this is only available for Mac. Ive used the [[http://kapeli.com/][Dash]] API Documentation browser (an external application) with Emacs, available for Mac.
#+BEGIN_SRC emacs-lisp :tangle no #+BEGIN_SRC emacs-lisp :tangle no
(use-package dash-at-point (use-package dash-at-point
:commands (dash-at-point) :commands (dash-at-point)
:general (:states 'normal "gD" 'dash-at-point)) :general (:states 'normal "gD" 'dash-at-point))
#+END_SRC #+END_SRC
However, Im 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. Im 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.
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 #+BEGIN_SRC emacs-lisp
(use-package devdocs (use-package devdocs