user673592
user673592

Reputation: 2120

Share abbreviations between major modes in abbrev-mode (Emacs)

I'd like to ask whether there is a way to share abbreviation definitions for abbrev-mode between several major modes. E.g.: in LaTeX-mode I'd like to have not only the latex-mode abbrevs (and of course the global ones) but also all those defined for text-mode and org-mode. Is copy/paste the only possibility? I hope not...

Thank you very much!

Upvotes: 2

Views: 203

Answers (1)

Francois G
Francois G

Reputation: 11985

Well, the list of abbreviation sources active in a given mode is stored in the list variable ac-sources (You can peek at the content of that variable at any time with C-h v). So, if you want the abbreviations of modeA to also be active in modeB, all you have to do is to define an appropriate hook:

 (add-hook 'B-mode-hook
                  (lambda ()
                    (add-to-list 'ac-sources 'ac-source-modeA)
                    ))

Upvotes: 2

Related Questions