I try to use emacs -Q and then input RET RET dd in *scratch* buffer and then M-x add-mode-abbrev, then after the prompting message Mode abbrev for "dd":, I input abcdefg RET.

So I defined an mode specific abbrev, but when I try to expand-abbrev when putting point after the previously input dd, nothing happened, even no warning messages.

My Emacs version is "GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0) of 2016-10-03".

Did I use expand-abbrev in a wrong way? Or does expand-abbrev of this version break?


1 Answer 1


I think you're looking for inverse-add-mode-abbrev, not add-mode-abbrev.

If you want to expand dd to abcdefg then use M-x inverse-add-mode-abbrev with the cursor after dd.

Command add-mode-abbrev defines an abbreviation for the last word. For instance, if the text in the buffer is george and you use M-x add-mode-abbrev with the cursor after that text, and then you type gg at the prompt then you have defined abbreviation gg for the word george.

In your case, you apparently want to define dd as an abbreviation for abcdefg, so you need to use inverse-add-mode-abbrev.


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.