nsf/gocode

Name kill-emacs-hook function

Opened this issue · 0 comments

(eval-after-load "go-mode"
  '(progn
     (let* ((user (or (getenv "USER") "all"))
            (sock (format (concat temporary-file-directory "gocode-daemon.%s") user)))
       (unless (file-exists-p sock)
         (add-hook 'kill-emacs-hook #'(lambda ()
                                        (ignore-errors
                                          (call-process company-go-gocode-command nil nil nil "close"))))))))

It's usually best practice to always name hook functions so that the user can call `remove-hook' on them.
It also helps readbility when inspecting the hook variable.