     (setq-local live-py-timer nil)
     (setq-local live-py-window-start-pos -1)
     (setq-local live-py-point-line-nr -1)
-    (add-hook 'kill-buffer-hook 'live-py-mode-off nil t)
-    (add-hook 'after-change-functions 'live-py-after-change-function nil t)
-    (add-hook 'post-command-hook 'live-py-post-command-function nil t)
+    (setq-local live-py-lighter live-py-lighter-fail)
+
+    (add-hook 'kill-buffer-hook #'live-py-mode-off nil t)
+    (add-hook 'after-change-functions #'live-py-after-change-function nil t)
+    (add-hook 'post-command-hook #'live-py-post-command-function nil t)
     (live-py-update-all))
    ;; Turning the mode OFF.
    (t
-    (remove-hook 'after-change-functions 'live-py-after-change-function t)
-    (remove-hook 'post-command-hook 'live-py-post-command-function t)
-    (remove-hook 'kill-buffer-hook 'live-py-mode-off t)
+    (remove-hook 'after-change-functions #'live-py-after-change-function t)
+    (remove-hook 'post-command-hook #'live-py-post-command-function t)
+    (remove-hook 'kill-buffer-hook #'live-py-mode-off t)
     (let ((output-window (get-buffer-window live-py-trace-name)))
       (when output-window (delete-window output-window)))
     (ignore-errors (kill-buffer live-py-trace-name))
-    (toggle-truncate-lines 0))))
+    (setq-local truncate-lines live-py-truncate-lines-original))))
 
 (provide 'live-py-mode)
 

(defun live-py-create-output-window ()
  "Create the output window."
  (delete-other-windows)
  (get-buffer-create live-py-trace-name)
  (toggle-truncate-lines 1)
  (with-current-buffer live-py-trace-name
    (toggle-truncate-lines 1)
    (setq-local show-trailing-whitespace nil))
  (set-window-buffer (split-window-horizontally) live-py-trace-name))


  "Lighter during the plugin state \"failed\".")

;; Internal variables.
(defvar-local live-py-truncate-lines-original nil)
(defvar-local live-py-source-last-active-window nil
  "Window where the source buffer was active the last time.
Can be different to the current window showing the source buffer
