               (remove-hook hook #'linum-mode))
             (global-linum-mode 1))
         (progn
-          (global-linum-mode -1)
+          (when global-linum-mode
+            (global-linum-mode -1))
           (dolist (hook modi/linum-mode-hooks)
             (add-hook hook #'linum-mode)))))
 

;; nlinum
;; http://elpa.gnu.org/packages/nlinum.html
(use-package nlinum
    :config
  (progn
    (global-nlinum-mode -1)
    (setq nlinum-format "%4d ") ; right aligned, 4 char wide line num col

    (defun modi/turn-on-nlinum ()
      "Turn on nlinum mode in specific modes."

(use-package linum
  :config
  (progn
    (defun modi/blend-linum ()
      "Set the linum foreground face to that of `font-lock-comment-face' and
background color to that of the theme."
      (interactive)
      (set-face-attribute
       'linum nil
