3

In auto-capitalize mode, whenever Latin abbreviations such as e.g. or i.e. are entered, auto-capitalize mode seems to be too eager, and capitalizes the first letters E and I after the first period . is entered.

Is it possible to configure the mode to trigger auto-capitalize only after the period plus a whitespace is entered?

(This seems to be a more natural way to capitalize to me.)

Drew
  • 75,699
  • 9
  • 109
  • 225
tinlyx
  • 1,276
  • 1
  • 12
  • 27
  • 3
    Maybe [this related question](https://stackoverflow.com/questions/22430229/how-to-instruct-emacs-auto-capitalize-mode-to-automatically-lowercase-any-word-t) could inspire you. I don't use this mode, so I can't tell. – Firmin Martin Jul 01 '21 at 20:15
  • 3
    @FirminMartin: FYI: You can post an answer here that essentially repeats what that SO answer says. (SE doesn't consider posts across areas to be duplicates.) – Drew Jul 01 '21 at 21:06
  • 3
    @Drew Thanks, it's good to know. I just don't have enough time to 1) invest on a package I personally don't use, 2) make sure that the answer is still relevant (it is written 7 years ago) and 3) adapt it to OP issue (although it's practically the same). That's why I suggest OP to test & tweak the answer as they are already familiar with the package and issue. Perhaps they would write a more precise answer than I would. But, yeah, I will definitely do so if the occasion is present. – Firmin Martin Jul 01 '21 at 21:29
  • @FirminMartin Thanks! I think the linked question does provide a practical answer to my question here, esp. the advice to use `C-q .'` instead of `.` . I had thought that changing the trigger condition is a natural fix. But `M-x quoted-insert` is a native solution. – tinlyx Jul 01 '21 at 21:57
  • 1
    @tinlyx That's nice to hear! Once you're satisfied, you can write your own answer and accept it. – Firmin Martin Jul 01 '21 at 22:23

1 Answers1

3

Based on the related SO question@Frimin, there are at least two ways to disable things like e.g., i.e..

One is to use regular expressions and auto-capitalize-predicate to filter them out explicitly in init.el:

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

The second is to manually replace the triggering whitespace or punctuation character with M-x quoted-insert (e.g. gnu C-q .).

tinlyx
  • 1,276
  • 1
  • 12
  • 27