plexus / chemacs

Emacs profile switcher
652 stars 45 forks source link

abbrev-file-name points to ~/.emacs.d #31

Closed league closed 4 years ago

league commented 4 years ago

When I'm using a custom, non-default profile, my abbrevs still get loaded and saved from ~/.emacs.d/abbrev_defs rather than pointing to user-emacs-directory. I suppose one solution is just to override it. But I'd like to understand why!

In abbrev.el, it's defined using

(defcustom abbrev-file-name
  (locate-user-emacs-file "abbrev_defs" ".abbrev_defs"))

The strange thing is that If I evaluate that locate-user-emacs-file expression, it points to the custom profile. And when I describe-variable it does show the “original value” is supposedly the right place:

abbrev-file-name is a variable defined in ‘abbrev.el’.
Its value is "~/.emacs.d/abbrev_defs"
Original value was 
"~/.emacs-profiles/mazo/abbrev_defs"

So something is setting it to ~/.emacs.d anyway? Any ideas?

plexus commented 4 years ago

Hi @league, that's quite puzzling. It seems it gets set correctly when that defcustom runs, but then somehow gets set back later on. Maybe you have a customize value for that variable? Try M-x customize-option abbrev-file-name.

I would also see what happens if you do this with an otherwise empty config. Does it still happen? Maybe something in your config is setting it back. You can try grepping for abbrev-file-name and see what comes up.

Good luck!

league commented 4 years ago

Good ideas – I recently had some mysterious setting that accidentally got added to my custom-set-variables block, but that's not the case here. I just tried it with a totally empty profile, and did customize-option; the symptoms are the same, and it says “CHANGED outside Customize.”

screenshot-20200503-153831

One thing I noticed with some tracing is that 'abbrev is already present in features (already loaded) before chemacs starts, so I guess the setting gets its value super-early. And perhaps what the help says is the original value is not really true. Anyway, it's easy to fix with a setq. Thanks,