fix(format): handle git-gutter nicely
This commit is contained in:
parent
7e15504163
commit
dc3b5c3710
2 changed files with 18 additions and 11 deletions
|
@ -33,17 +33,16 @@ select buffers.")
|
|||
(funcall orig-fn)))
|
||||
|
||||
(add-hook! 'apheleia-post-format-hook
|
||||
;; HACK `web-mode' doesn't update syntax highlighting after arbitrary buffer
|
||||
;; modifications, so we must trigger refontification manually.
|
||||
(defun +format--fix-web-mode-fontification-h ()
|
||||
(when (eq major-mode 'web-mode)
|
||||
(setq web-mode-fontification-off nil)
|
||||
(when (and web-mode-scan-beg web-mode-scan-end global-font-lock-mode)
|
||||
(save-excursion
|
||||
(font-lock-fontify-region web-mode-scan-beg web-mode-scan-end)))))
|
||||
(defun +format--refresh-git-gutter-h ()
|
||||
(when (bound-and-true-p git-gutter-mode)
|
||||
(git-gutter))))
|
||||
;; HACK `web-mode' doesn't update syntax highlighting after arbitrary buffer
|
||||
;; modifications, so we must trigger refontification manually.
|
||||
(defun +format--fix-web-mode-fontification-h ()
|
||||
(when (eq major-mode 'web-mode)
|
||||
(setq web-mode-fontification-off nil)
|
||||
(when (and web-mode-scan-beg web-mode-scan-end global-font-lock-mode)
|
||||
(save-excursion
|
||||
(font-lock-fontify-region web-mode-scan-beg web-mode-scan-end)))))
|
||||
(defun +format--refresh-git-gutter-h ()
|
||||
(+vc-gutter-init-maybe-h)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue