Function: python-shell-font-lock-with-font-lock-buffer

python-shell-font-lock-with-font-lock-buffer is a macro defined in python.el.gz.

Signature

(python-shell-font-lock-with-font-lock-buffer &rest BODY)

Documentation

Execute the forms in BODY in the font-lock buffer.

The value returned is the value of the last form in BODY. See also with-current-buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body)
  "Execute the forms in BODY in the font-lock buffer.
The value returned is the value of the last form in BODY.  See
also `with-current-buffer'."
  (declare (indent 0) (debug t))
  `(python-shell-with-shell-buffer
     (save-current-buffer
       (when (not (and python-shell--font-lock-buffer
                       (get-buffer python-shell--font-lock-buffer)))
         (setq python-shell--font-lock-buffer
               (python-shell-font-lock-get-or-create-buffer)))
       (set-buffer python-shell--font-lock-buffer)
       (when (not font-lock-mode)
         (font-lock-mode 1))
       (setq-local delay-mode-hooks t)
       (let ((python-indent-guess-indent-offset nil))
         (when (not (derived-mode-p 'python-mode))
           (python-mode))
         ,@body))))