Search code examples
emacspurescript

How do I automatically run a binary in the background using Emacs Lisp when in a particular major mode?


I would like to automatically run the purescript language server binary in the background when Emacs loads a .purs PureScript file in PureScript mode. Is there an easy way to do this using Emacs Lisp in my init.el file?


Solution

  • (defun my-program ()
      (message "Start to run my-program")
      ;; Replace with your binary.
      (shell-command "pwd"))
    (add-hook 'purescript-mode-hook #'my-program)