4

I keep my abbrev_defs file in a git repository so I can share my abbreviations across systems. Unfortunately, the count feature of abbrev-mode leads to little changes in the :count property of defined abbreviations in this file that makes merging a big hassle.

Is there a good way to fix this?

I would be happy to just disable counting how often I use an abbreviation or saving this but there doesn't seem to be any built-in way to do this in the source of abbrev.el. I could advise write-abbrev-file to remove all counts from all abbrev tables first but that seems pretty clunky.

Michael Hoffman
  • 665
  • 6
  • 14

1 Answers1

2

If you're happy ignoring the :count properties, then you could try this:

Say the value of abbrev-file-name is abbrev.el. Create a copy of that file, say my-abbrev.el. Add abbrev.el to .gitignore, add my-abbrev.el to your repository. Add the following to your init file:

(quietly-read-abbrev-file "~/.emacs.d/my-abbrev.el")

When you want to add or modify an abbrev, do so directly in my-abbrev.el rather than via the standard commands (add-global-abbrev, etc.)