     (defun modi/turn-on-linum ()
       "Turn on linum mode in specific modes."
       (interactive)
-      (dolist (hook modi/linum-mode-hooks)
-        (add-hook hook #'linum-mode)))
+      (if modi/linum-mode-enable-global
+          (progn
+            (dolist (hook modi/linum-mode-hooks)
+              (remove-hook hook #'linum-mode))
+            (global-linum-mode 1))
+        (progn
+          (global-linum-mode -1)
+          (dolist (hook modi/linum-mode-hooks)
+            (add-hook hook #'linum-mode)))))
 
     (defun modi/turn-off-linum ()
       "Unhook linum mode from various major modes."
       (interactive)
+      (global-linum-mode -1)
       (dolist (hook modi/linum-mode-hooks)
         (remove-hook hook #'linum-mode)))))
 

;; Time-stamp: <2015-03-18 09:42:42 kmodi>

;; Line number package manager


    (defun modi/turn-on-nlinum ()
      "Turn on nlinum mode in specific modes."
      (interactive)
      (if modi/linum-mode-enable-global
          (progn
            (dolist (hook modi/linum-mode-hooks)
              (remove-hook hook #'nlinum-mode))
            (global-nlinum-mode 1))
        (progn
          (global-nlinum-mode -1)
          (dolist (hook modi/linum-mode-hooks)
            (add-hook hook #'nlinum-mode)))))

    (defun modi/turn-off-nlinum ()
      "Unhook nlinum mode from various major modes."
      (interactive)
      (global-nlinum-mode -1)
      (dolist (hook modi/linum-mode-hooks)
        (remove-hook hook #'nlinum-mode)))))

