0

I defined a global abbrev, then thought that I better make it a local one, so I wanted to save the abbrevs, then edit abbrev_defs accordingly. So I used abbrev-edit-save-buffer, then opened abbrev_defs and got a nice scare when the file was empty except for the top line! Luckily, I'm using btrfs and had system snapshots I could take the file from. Then I tried the same thing, defining an abbrev using add-global-abbrev, then using abbrev-edit-save-buffer in a variety of conditions, including without init, and it always had the same result: replacing my a,abbrev_defs with a file empty except for the top line. Yet, if I define an abbrev, then quit Emacs and agree to save abbrevs, it adds the defined abbrevs to abbrev_defs as it should. So clearly, I'm not supposed to use abbrev-edit-save-buffer like that. But using define-abbrevs doesn't seem to change abbrev_defs at all. So what exactly am I supposed to do to save my abbrevs to abbrev_defs?

2
  • See Saving Abbrevs in the Emacs manual.
    – NickD
    Commented May 6 at 14:04
  • What is the value of abbrev-file-name? Are you sure you are checking the correct file? If I do (setq abbrev-file-name "/tmp/foo_abbrev_defs"), then M-x list-abbrevs, then in the *Abbrevs* buffer, I do M-x abbrev-edit-save-buffer, I find all my global abbrevs (the only kind I have) in /tmp/foo_abbrev_defs. Don't forget to reset abbrev-file-name afterwards! Make sure you are doing M-x abbrev-edit-save-buffer from the *Abbrevs* buffer, not some arbitrary buffer.
    – NickD
    Commented May 6 at 14:15

1 Answer 1

1

It's only a guess, but it seems you are in the wrong buffer when you are running the command. Make sure you are doing M-x abbrev-edit-save-buffer from the *Abbrevs* buffer, not some arbitrary buffer.

1
  • Oh, I see, thanks, I thought I was supposed to run it from the buffer I defined the abbrevs in. Commented May 6 at 14:28

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.