Apologies if my question is silly, it's my first day using abbrev expand.

I have an abbrev set up like this

"bm"           3    "bookmarks-acd1fe"

When I press bm tab, I end up with

bookmarks-acd1fe<tab character here>

I didn't want a tab character, why is it inserting tab? ¯_(ツ)_/¯

  • Simply inserting "bm" should do nothing. Assume a key followed "m"? Which? How did you call "expand abbrev"? – Andreas Röhler Oct 15 '19 at 4:37
  • I pressed tab to call expand abbrev. – american-ninja-warrior Oct 15 '19 at 12:42
  • Okay, added respective answer. – Andreas Röhler Oct 15 '19 at 14:05

When you enter bmTAB, abbrev expands and then inserts the tab you entered. If you had hit SPACE instead, it would have entered a space.

Emacs links process of expanding abbreviations to a couple of character-inserts, called self-insert-command. I.e. when abbrev-mode is on and such a character gets inserted, Emacs looks before point for an abbreviation and expands it if found. Characters which trigger expand-abbrev are SPACE and TAB. It's also possible to call it interactively: M-x expand-abbrev RET.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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