From b4b661d885a9fd771f5b165142bc89c6c9f243bf Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 17 May 2012 00:03:40 -0300 Subject: [PATCH] Customizable variable to control syntax highlighting in shell. Default is on. --- lisp/progmodes/python.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 16a3befc3f2..75b9f0c087e 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1223,6 +1223,13 @@ It should not contain a caret (^) at the beginning." :group 'python :safe 'stringp) +(defcustom python-shell-enable-syntax-highlighting t + "Should syntax highlighting be enabled in the python shell buffer? +Restart the python shell after changing this variable for it to take effect." + :type 'boolean + :group 'python + :safe 'booleanp) + (defcustom python-shell-send-setup-max-wait 5 "Seconds to wait for process output before code setup. If output is received before the especified time then control is @@ -1382,6 +1389,7 @@ controls which Python interpreter is run. Variables `python-shell-prompt-regexp', `python-shell-prompt-output-regexp', `python-shell-prompt-block-regexp', +`python-shell-enable-syntax-highlighting', `python-shell-completion-setup-code', `python-shell-completion-string-code', `python-shell-completion-module-string-code', @@ -1415,6 +1423,12 @@ variable. 'python-shell-completion-complete-at-point) (define-key inferior-python-mode-map (kbd "") 'python-shell-completion-complete-or-indent) + (when python-shell-enable-syntax-highlighting + (set + (make-local-variable 'font-lock-defaults) + '(python-font-lock-keywords + nil nil nil nil + (font-lock-syntactic-keywords . python-font-lock-syntactic-keywords)))) (compilation-shell-minor-mode 1)) (defun python-shell-make-comint (cmd proc-name &optional pop) -- 2.39.2