Search code examples
spacemacs

Spacemacs: Run function after every file load


I have defined a function fira-code in dotspacemacs/user-init that runs the “setup” code for the Fira Code ligatures as described here: https://github.com/tonsky/FiraCode/wiki/Setting-up-Emacs

I then call this function in dotspacemacs/user-config. This almost works. When I first open a file, the ligatures are not shown, and Fira Code is not the current font. But if I then press <space> f e R to reload the config, it works. How can I make this work when first opening a file?


Solution

  • Instead of calling the function directly, add it as a prog-mode hook:

    (add-hook 'prog-mode-hook
      'fira-code)