   (advice-add #'nlinum--region :override #'doom*nlinum-region)
 
   ;; Optimization: calculate line number column width beforehand
-  (add-hook! nlinum-mode
+  (defun doom|init-nlinum-width ()
     (setq nlinum--width
           (length (save-excursion (goto-char (point-max))
-                                  (format-mode-line "%l"))))))
+                                  (format-mode-line "%l")))))
+  (add-hook 'nlinum-mode-hook #'doom|init-nlinum-width))
 
 ;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
 ;; languages like Lisp.

  (defvar linum-format "%3d ")
  (defvar nlinum-format "%4d ")
  :init
  (add-hook! (prog-mode text-mode)
    (unless (eq major-mode 'org-mode)
      (nlinum-mode +1)))
  :config
  (setq nlinum-highlight-current-line t)


  (push (cons 'left-fringe  doom-ui-fringe-size) default-frame-alist)
  (push (cons 'right-fringe doom-ui-fringe-size) default-frame-alist)
  ;; no fringe in the minibuffer
  (add-hook! '(emacs-startup-hook minibuffer-setup-hook)
    (set-window-fringes (minibuffer-window) 0 0 nil)))


