Skip to content

Commit

Permalink
Respect global-font-lock-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Apr 20, 2017
1 parent e2bd3d1 commit d7e0464
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions emacs-company/company-go.el
Expand Up @@ -195,14 +195,17 @@ triggers a completion immediately."

(defun company-go--syntax-highlight (str)
"Apply syntax highlighting to STR."
(with-temp-buffer
(insert str)
(delay-mode-hooks (go-mode))
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(with-no-warnings
(font-lock-fontify-buffer)))
(buffer-string)))
;; If the user has disabled font-lock, respect that.
(if global-font-lock-mode
(with-temp-buffer
(insert str)
(delay-mode-hooks (go-mode))
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(with-no-warnings
(font-lock-fontify-buffer)))
(buffer-string))
str))

;;;###autoload
(defun company-go (command &optional arg &rest ignored)
Expand Down

0 comments on commit d7e0464

Please sign in to comment.