神刀安全网

Linting Prose in Emacs with ProseLinter

Recently, I came across the Proselint project, which aspires to be something like a “linter” for written English prose. It differs from spelling or grammar checker in that it is primarily focused on logic and style, taking its advice from the work of many prominent writers on writing.

The project seems to be a little rough around the edges (code blocks seem to make it struggle, for example), but it’s also perfectly usable in its current form. It’s available as a Python package, so you can pip install proselint to get the command-line tool, proselint .

Thanks to the Flycheck framework it’s comically easy to get this imported into a Emacs writing environment. The following snippet will get you up and running in text and markdown modes:

(flycheck-define-checker proselint   "A linter for prose."   :command ("proselint" source-inplace)   :error-patterns   ((warning line-start (file-name) ":" line ":" column ": "         (id (one-or-more (not (any " "))))         (message) line-end))   :modes (text-mode markdown-mode gfm-mode))  (add-to-list 'flycheck-checkers 'proselint)

Proselint won’t focus on checking your grammar and spelling. But it will point out that referring to my very unique sense of humour commits both a subtle language error, and a not-so-subtle error of style:

Linting Prose in Emacs with ProseLinter

Every lint in Proselint is named after the authority to whom it appeals: in these two examples, Mark Twain and David Foster Wallace. While my sentence is grammatically correct, these two authors would take issue with it. Wallace points out that “very unique” doesn’t really make sense — a thing is either unique or not. And Twain seems to take issue with the usage of “very” in general.

If this kind of feedback appeals to you, Proselint might be worth a try. Given the simplicity of the Flycheck-based approach, I don’t think there’s a need for a seperate proselint.el package at the moment, but perhaps someone should submit a small one to the Proselint project itself, which appears to accept plugins .

I’ve also heard of the writegood-mode and artbollocks-mode packages, which address similar issues.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Linting Prose in Emacs with ProseLinter

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮