Skip to content

Instantly share code, notes, and snippets.

@incandescentman
Created July 15, 2015 19:00
Show Gist options
  • Save incandescentman/5932fbc1d578c7fc7f4a to your computer and use it in GitHub Desktop.
Save incandescentman/5932fbc1d578c7fc7f4a to your computer and use it in GitHub Desktop.

[#C] create an auto-capitalization-predicate-exceptions-list?

I’d like to create a plain-text list of words that are exceptions to auto-capitalization. So for e.g. if I type e.g. like I have in this sentence, I don’t want the next word to be automatically capitalized.

See my existing code:

(setq auto-capitalize-predicate
      (lambda () (not (looking-back "\\([Ee]\\.g\\|[Uu]\\.S\\|[Ii]\\.e\\|\\.\\.\\)\\.[^.]*" (- (point) 20)))))

This works. However, I’d like to be able to keep this list in a plain text format and add to it. The reason I’m asking is because I wanted to add the word “vs.” to the list (e.g. “good vs. evil”) but I couldn’t get the regexp correct with all the slash escaping. It would be easier if the list looked something like this:

(setq *auto-capitalize-exceptions*
  (list "e.g." "i.e. " "vs." "..." "- [ ] ")) 

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment