writegood-mode icon indicating copy to clipboard operation
writegood-mode copied to clipboard

oxford commas

Open anarcat opened this issue 6 years ago • 4 comments

I know this might be controversial, as there are basically two opposing sides of that debate, but I would love it if writegood-mode could (optionally) outline oxford commas (as a) mistake. Depending on the config, this would be marked as an error:

foo, bar and baz

or this:

foo, bar, and baz

The former could be matched with this regex:

\([[:alpha:]]+,[[:space:]]+\)+[[:alpha:]]+[[:space:]]+\(and\|or\)[[:space:]][[:alpha:]]+

... according to this answer. The latter would be matched with:

\([[:alpha:]]+,[[:space:]]+\){2,}\(and\|or\)[[:space:]][[:alpha:]]+

Would you be open to such an extension, provided it's a toggle?

anarcat avatar May 20 '18 18:05 anarcat

@anarcat, this is an excellent idea. Would you be able to make a pull request?

Also, I believe that the two regexes you have listed will be incomplete and unable to match lists consisting of elements of multiple words. Consider these examples:

I like The Lord of the Rings, Star Wars and Harry Potter. or I like The Lord of the Rings, Star Wars, and Harry Potter.

bnbeckwith avatar May 22 '18 03:05 bnbeckwith

ah, true. how do we resolve that conendrum?

i'd be happy to do a PR, but I'm not sure where to begin... pointers in the code? :) i guess i'd need a defcustom for the toggle, is there a list of regex the plugin looks for already?

anarcat avatar May 22 '18 03:05 anarcat

Thank you for the package @bnbeckwith. I was just wanted to check if this has been included now.

5uie avatar Sep 25 '22 18:09 5uie

if this issue is still open, i would assume not.

anarcat avatar Sep 25 '22 18:09 anarcat