                 (advice-add 'next-buffer
                             :before
                             #'spacemacs//centered-buffer-mode-prev-next-buffer-advice)
+                (add-hook 'after-change-functions
+                          #'spacemacs//centered-buffer-after-change-function
+                          nil
+                          t)
                 (add-hook 'buffer-list-update-hook
                           'spacemacs//centered-buffer-buffer-list-update-fringes)
                 (add-hook 'window-configuration-change-hook

    (if (bound-and-true-p org-indent-mode) 40
      spacemacs-centered-buffer-mode-safety-gap-width)))

(defun spacemacs//centered-buffer-buffer-list-update-fringes ()
  "Used in `buffer-list-update-hook' and `window-configuration-change-hook'."
  (dolist (frame (frame-list))
    (when (frame-live-p frame)
      (dolist (window (window-list frame 2))
        (when (and (buffer-local-value 'spacemacs--centered-buffer-mode-origin-buffer
                                       (window-buffer window))
                   ;; Might be needed because
                   ;; (spacemacs-centered-buffer-mode -1) kills buffers.
                   (buffer-live-p (window-buffer window)))
          (let ((fringe-w (spacemacs//centered-buffer-calc-fringe
                           window
                           spacemacs--centered-buffer-mode-text-pixel-size)))
            (if (> fringe-w spacemacs-centered-buffer-mode-min-fringe-width)
                (set-window-fringes window fringe-w fringe-w t)
              (spacemacs-centered-buffer-mode -1)))))))
  ;; Prevent premature evaluation.
  (when spacemacs--centered-buffer-mode-indirect-buffers
    (spacemacs//centered-buffer-prune-indirect-buffer-list)))

(defun spacemacs//centered-buffer-prune-indirect-buffer-list ()
  "Remove indirect buffer from the `spacemacs--centered-buffer-mode-indirect-buffers'

                   #'spacemacs//centered-buffer-mode-prev-next-buffer-advice)
    (advice-remove 'next-buffer
                   #'spacemacs//centered-buffer-mode-prev-next-buffer-advice)
    (remove-hook 'after-change-functions
                 #'spacemacs//centered-buffer-after-change-function)
    (remove-hook 'buffer-list-update-hook
                 'spacemacs//centered-buffer-buffer-list-update-fringes)
    (remove-hook 'window-configuration-change-hook
