I don't know exactly how abbrev-mode works, but I suppose certain keys --spaces and stops-- cause an examination of the word before point, and a replacement of it in some cases. My question is how one might hook on to that mechanism, say to encrypt every word typed, at abbreviation-expansion time. Methods that do not make use of abbrev-mode are also welcome, and probably preferable.

  • Customize pre-abbrev-expand-hook.
    – Drew
    Commented Nov 18, 2018 at 17:39
  • C-h o pre-abbrev-expand-hook says: This variable is obsolete since 23.1; use ‘abbrev-expand-function’ instead..
    – Stefan
    Commented Nov 18, 2018 at 20:05

1 Answer 1


You can use abbrev-expand-function for that. But you could also use post-self-insert-hook in order to be independent from abbrev-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.