From 0052d9b30f894eeab1c23a4ca2f1bb75c3a7cd5b Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Wed, 14 Nov 2018 02:21:40 -0600 Subject: [PATCH] jupyter-insert: Only fontify the docstring region for Python inspect requests * jupyter-python.el (jupyter-insert): Do it. --- jupyter-python.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jupyter-python.el b/jupyter-python.el index 44e5013..2e3b529 100644 --- a/jupyter-python.el +++ b/jupyter-python.el @@ -63,9 +63,14 @@ buffer." (cond ((and (eq mime :text/plain) (eq (jupyter-message-type msg) :inspect-reply)) - (when (search-forward "Docstring:" nil t) - (jupyter-fontify-region-according-to-mode - #'rst-mode (1+ (point)) (point-max)))) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^Docstring:" nil t) + (jupyter-fontify-region-according-to-mode + #'rst-mode (1+ (point)) + (or (and (re-search-forward "^File:" nil t) + (line-beginning-position)) + (point-max)))))) (t nil))))) (cl-defmethod jupyter-load-file-code (file &context (jupyter-lang python))