From 149066dbfc7f11c40f6dbed70a3279153bf3ab7a Mon Sep 17 00:00:00 2001 From: immerrr Date: Mon, 12 Oct 2015 14:17:16 +0300 Subject: [PATCH 2/2] Prevent infinite loop in python-info-docstring-p python-info-docstring-p did not expect that python-nav-beginning-of-statement could leave point intact not at the beginning of buffer which happened if the first statement in the file was indented (it is a Python syntax error). * python.el (python-nav--forward-sexp): if backward-sexp brought point to the beginning of the buffer, leave it there --- lisp/progmodes/python.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 6ff12b5..7ccd204 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1712,7 +1712,11 @@ expressions when looking at them in either direction." (python-nav-beginning-of-block)) ((memq context '(statement-start block-start)) (goto-char next-sexp-pos) - (python-nav-beginning-of-statement)) + (unless (bobp) + ;; If backward-sexp brought the point to + ;; beginning-of-buffer, beginning-of-statement + ;; will only bring it back. + (python-nav-beginning-of-statement))) (t (goto-char next-sexp-pos)))))))))) (defun python-nav-forward-sexp (&optional arg safe skip-parens-p) -- 2.6.1