                               (get-buffer live-py-output-buffer)))))
     (save-restriction
       (widen)
-      ;; Create (or recreate) if necessary, update and last but not least
-      ;; display output buffer.
-      (if (eq 0
-              (shell-command-on-region 1
-                                       (1+ (buffer-size))
-                                       command-line
-                                       live-py-output-buffer))
-          (setq live-py-lighter " live")
-        (setq live-py-lighter " live(FAIL)")))
+      (setq-local
+       live-py-lighter
+       ;; Create (or recreate) if necessary, update and last but not least
+       ;; display output buffer.
+       (if (eq 0 (shell-command-on-region 1
+                                          (1+ (buffer-size))
+                                          command-line
+                                          live-py-output-buffer))
+           " live"
+         " live(FAIL)")))
     (with-current-buffer live-py-output-buffer
-      (setq buffer-read-only 1)
+      (setq-local buffer-read-only 1)
       (unless reused-buffer (toggle-truncate-lines 1)))
     (live-py-synchronize-scroll
      (line-number-at-pos (window-start)) (line-number-at-pos))
-    (set 'live-py-timer nil)))
+    (setq-local live-py-timer nil)))
 
 (defun live-py-synchronize-scroll (window-start-line-nr point-line-nr)
   "Synchronize scrolling between Python and output buffer.

  (with-current-buffer live-py-output-buffer
    (toggle-truncate-lines 1)
    (setq-local show-trailing-whitespace nil))
  (set (make-local-variable 'live-py-output-window)
       (split-window-horizontally))
  (set-window-buffer live-py-output-window live-py-output-buffer))

(defun live-py-set-driver()


   ;; Turning the mode ON.
   (live-py-mode
    (setq live-py-dir (file-name-directory buffer-file-name)
          live-py-version "python")
    ;; Create a unique name for the trace output buffer.
    (setq-local live-py-output-buffer
                (concat "*live-py-output_"
                        (file-name-nondirectory (buffer-file-name))
                        "_"
                        (make-temp-name "")
                        "*"))
    (setq-local live-py-module (file-name-base buffer-file-name))
    (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)
    (live-py-show-output-window)
