emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/writegood-mode ecb888b659 01/47: Initial version


From: ELPA Syncer
Subject: [nongnu] elpa/writegood-mode ecb888b659 01/47: Initial version
Date: Mon, 12 Dec 2022 21:01:39 -0500 (EST)

branch: elpa/writegood-mode
commit ecb888b659d5db75ddf49f7eff33da85503746f7
Author: Benjamin Beckwith <bnbeckwith@gmail.com>
Commit: Benjamin Beckwith <bnbeckwith@gmail.com>

    Initial version
---
 README.markdown   |  10 +++
 writegood-mode.el | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 215 insertions(+)

diff --git a/README.markdown b/README.markdown
new file mode 100755
index 0000000000..5c8a95d786
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,10 @@
+
+
+# Writegood Mode #
+
+This is a minor mode to aid in finding comming writing
+problems. 
[http://matt.might.net/articles/shell-scripts-for-passive-voice-weasel-words-duplicates/](Matt
+Might's weaselwords scripts) inspired this mode.
+
+It highlights text based on a set of weasel-words, passive-voice and
+duplicate words.
diff --git a/writegood-mode.el b/writegood-mode.el
new file mode 100755
index 0000000000..b5a74272be
--- /dev/null
+++ b/writegood-mode.el
@@ -0,0 +1,205 @@
+;; writegood-mode.el --- Count number of words in a buffer
+;;
+;; Author: Benjamin Beckwith
+;; Created: 2010-8-12
+;; Version: 1.0
+;; Last-Updated: 2010-8-13
+;; URL: 
+;; Keywords: writing weasel-words
+;; Compatability:
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;;  This minor mode tries to find and highlight problems with your
+;;  writing (in english).
+;;
+;;  Behavior inspired by the weaselwords scripts to aid in good
+;;  writing.
+;;  
http://matt.might.net/articles/shell-scripts-for-passive-voice-weasel-words-duplicates/
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Change Log:
+;;
+;; 1.0 Initial version
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 3, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Test Text:
+;;
+;; This mode will improve various aspects of your writing in many ways.
+;; The text is searched and aspects are highlighted. 
+;; Another benefit is the the finding of duplicates
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Code:
+
+(eval-when-compile
+  (require 'cl))
+
+(require 'regexp-opt)
+(require 'faces)
+
+(defgroup writegood nil
+  "Minor mode for highlighting bad english writing."
+  :prefix "writegood-"
+  :group 'help
+  :link '(url-link "http://github_link_here";))
+
+;; Weaselwords
+(defface writegood-weasels-face
+  '((((class color) (background light))
+     (:inherit font-lock-warning-face :background "orange"))
+    (((class color) (background dark))
+     (:inherit font-lock-warning-face :background "DarkOrange")))
+  "Writegood face for weasel words"
+  :group 'writegood)
+
+(defcustom writegood-weasel-words
+  '("many" "various" "very" "fairly" "several" "extremely" 
+    "exceedingly" "quite" "remarkably" "few" "surprisingly" 
+    "mostly" "largely" "huge" "tiny" "are a number" "is a number" 
+    "excellent" "interestingly" "significantly" "substantially" 
+    "clearly" "vast" "relatively" "completely")
+  "The weasel words to use"
+  :group 'writegood
+  :type 'list)
+  
+(defvar writegood-weasels-font-lock-keywords-regexp
+ (regexp-opt writegood-weasel-words)
+ "Matches weasel-words")
+
+(defconst writegood-weasels-font-lock-keywords
+  (list (list writegood-weasels-font-lock-keywords-regexp
+             0 (quote 'writegood-weasels-face) 'prepend)))
+
+;; Passive Voice
+(defface writegood-passive-voice-face
+  '((((class color))
+     (:inherit font-lock-warning-face :background "yellow")))
+  "Writegood face for passive-voice"
+  :group 'writegood)
+
+(defcustom writegood-passive-voice-irregulars
+  '("awoken" "been" "born" "beat" "become" "begun" "bent" "beset" 
+    "bet" "bid" "bidden" "bound" "bitten" "bled" "blown" "broken" 
+    "bred" "brought" "broadcast" "built" "burnt" "burst" "bought" 
+    "cast" "caught" "chosen" "clung" "come" "cost" "crept" "cut" 
+    "dealt" "dug" "dived" "done" "drawn" "dreamt" "driven" "drunk" 
+    "eaten" "fallen" "fed" "felt" "fought" "found" "fit" "fled" 
+    "flung" "flown" "forbidden" "forgotten" "foregone" "forgiven" 
+    "forsaken" "frozen" "gotten" "given" "gone" "ground" "grown" 
+    "hung" "heard" "hidden" "hit" "held" "hurt" "kept" "knelt" "knit" 
+    "known" "laid" "led" "leapt" "learnt" "left" "lent" "let" "lain" 
+    "lighted" "lost" "made" "meant" "met" "misspelt" "mistaken" "mown" 
+    "overcome" "overdone" "overtaken" "overthrown" "paid" "pled" "proven" 
+    "put" "quit" "read" "rid" "ridden" "rung" "risen" "run" "sawn" 
+    "said" "seen" "sought" "sold" "sent" "set" "sewn" "shaken" "shaven" 
+    "shorn" "shed" "shone" "shod" "shot" "shown" "shrunk" "shut" 
+    "sung" "sunk" "sat" "slept" "slain" "slid" "slung" "slit" 
+    "smitten" "sown" "spoken" "sped" "spent" "spilt" "spun" "spit" 
+    "split" "spread" "sprung" "stood" "stolen" "stuck" "stung" 
+    "stunk" "stridden" "struck" "strung" "striven" "sworn" "swept" 
+    "swollen" "swum" "swung" "taken" "taught" "torn" "told" "thought" 
+    "thrived" "thrown" "thrust" "trodden" "understood" "upheld" "upset" 
+    "woken" "worn" "woven" "wed" "wept" "wound" "won" "withheld" 
+    "withstood" "wrung" "written")
+  "List of passive voice irregular verbs"
+  :group 'writegood
+  :type 'list)
+
+(defvar writegood-passive-voice-font-lock-keywords-regexp
+  (concat "\\b\\(am\\|are\\|were\\|being\\|is\\|been\\|was\\|be\\)\\b[ 
]*\\(\\w+ed\\|"
+         (regexp-opt writegood-passive-voice-irregulars)
+         "\\)")
+  "Font-lock keywords regexp for passive-voice")
+
+(defconst writegood-passive-voice-font-lock-keywords
+  (list (list writegood-passive-voice-font-lock-keywords-regexp
+             0 (quote 'writegood-passive-voice-face) 'prepend)))
+
+;; Duplicates
+(defface writegood-duplicates-face
+  '((((class color) (background light))
+     (:inherit font-lock-warning-face :background "HotPink"))
+    (((class color) (background dark))
+     (:inherit font-lock-warning-face :background "DeepPink")))
+  "Writegood face for duplicate words"
+  :group 'writegood)
+
+(defvar writegood-duplicates-font-lock-keywords-regexp
+  "\\b\\(\\w+\\)[ ]+\\1"
+  "Font-lock keywords for duplicates")
+
+(defconst writegood-duplicates-font-lock-keywords
+  (list (list writegood-duplicates-font-lock-keywords-regexp
+             0 (quote 'writegood-duplicates-face) 'prepend)))
+
+;;;;;;;;;;;;;;;;;;;; Functions:
+
+(defun writegood-weasels-turn-on ()
+  "Turn on syntax highlighting for weasels"
+  (font-lock-add-keywords nil writegood-weasels-font-lock-keywords))
+
+(defun writegood-passive-voice-turn-on ()
+  "Turn on warnings for passive voice"
+  (font-lock-add-keywords nil writegood-passive-voice-font-lock-keywords))
+
+(defun writegood-duplicates-turn-on ()
+  "Turn on warnings for duplicate words"
+  (font-lock-add-keywords nil writegood-duplicates-font-lock-keywords))
+
+(defun writegood-weasels-turn-off ()
+  "Turn on syntax highlighting for weasels"
+  (font-lock-remove-keywords nil writegood-weasels-font-lock-keywords))
+
+(defun writegood-passive-voice-turn-off ()
+  "Turn on warnings for passive voice"
+  (font-lock-remove-keywords nil writegood-passive-voice-font-lock-keywords))
+
+(defun writegood-duplicates-turn-off ()
+  "Turn on warnings for duplicate words"
+  (font-lock-remove-keywords nil writegood-duplicates-font-lock-keywords))
+
+(defun writegood-turn-on ()
+  "Turn on writegood-mode."
+  (writegood-weasels-turn-on)
+  (writegood-passive-voice-turn-on)
+  (writegood-duplicates-turn-on))
+
+(defun writegood-turn-off ()
+  "Turn off writegood-mode."
+  (writegood-weasels-turn-off)
+  (writegood-passive-voice-turn-off)
+  (writegood-duplicates-turn-off))
+
+(define-minor-mode writegood-mode
+  "Colorize issues with the writing in the buffer."
+  :lighter " WryteGud"
+  (progn
+    (if writegood-mode
+       (writegood-turn-on)
+      (writegood-turn-off))
+    (font-lock-mode 1)))
+
+(provide 'writegood-mode)
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]