Given a file:
def f():
"""Testing a docstring."""
place point inside docstring and call fill-paragraph. I get an error "Lisp nesting exceeds max-eval-depth". Stacktrace:
<repeating here...>
py-beginning-of-statement(40 t)
(cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this (nth 8 (syntax-ppss))))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before (point)) 92) (save-excursion (< 0 (% (abs ...) 2))))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done)))
(let ((orig (or orig (point))) (cui (current-indentation)) (pps (syntax-ppss)) (done done) erg) (cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this (nth 8 ...)))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before (point)) 92) (save-excursion (< 0 (% ... 2))))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done))) (if (and (looking-at "[ ]*#") (looking-back "^[ ]*")) nil (if (< (point) orig) (progn (setq erg (point))))) (if (and py-verbose-p (interactive-p)) (progn (message "%s" erg))) erg)
(if (bobp) nil (let ((orig (or orig (point))) (cui (current-indentation)) (pps (syntax-ppss)) (done done) erg) (cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this ...))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before ...) 92) (save-excursion (< 0 ...)))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done))) (if (and (looking-at "[ ]*#") (looking-back "^[ ]*")) nil (if (< (point) orig) (progn (setq erg (point))))) (if (and py-verbose-p (interactive-p)) (progn (message "%s" erg))) erg))
py-beginning-of-statement(40 t)
(progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done))
(if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))
(cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this (nth 8 (syntax-ppss))))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before (point)) 92) (save-excursion (< 0 (% (abs ...) 2))))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done)))
(let ((orig (or orig (point))) (cui (current-indentation)) (pps (syntax-ppss)) (done done) erg) (cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this (nth 8 ...)))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before (point)) 92) (save-excursion (< 0 (% ... 2))))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done))) (if (and (looking-at "[ ]*#") (looking-back "^[ ]*")) nil (if (< (point) orig) (progn (setq erg (point))))) (if (and py-verbose-p (interactive-p)) (progn (message "%s" erg))) erg)
(if (bobp) nil (let ((orig (or orig (point))) (cui (current-indentation)) (pps (syntax-ppss)) (done done) erg) (cond ((or (empty-line-p) (nth 8 pps)) (while (and (not (bobp)) (or (empty-line-p) (setq this ...))) (if (empty-line-p) (skip-chars-backward "
\n\f") (goto-char this))) (py-beginning-of-statement orig done)) ((nth 8 pps) (goto-char (nth 8 pps)) (py-beginning-of-statement orig done)) ((nth 1 pps) (goto-char (1- (nth 1 pps))) (setq done t) (py-beginning-of-statement orig done)) ((save-excursion (beginning-of-line) (skip-chars-backward "
\n\f") (and (eq (char-before ...) 92) (save-excursion (< 0 ...)))) (forward-line -1) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done)) ((looking-at py-string-delim-re) (if (< 0 (abs (skip-chars-backward "
\n\f"))) (progn (setq done t))) (back-to-indentation) (py-beginning-of-statement orig done)) ((and (eq (point) orig) (looking-back ";[ ]*")) (goto-char (match-beginning 0)) (skip-chars-backward ";") (py-beginning-of-statement orig done)) ((and (not (eq (point) orig)) (looking-back ";[ ]*")) (setq erg (point))) ((and (not done) (not (eq 0 (skip-chars-backward "
\n\f")))) (py-beginning-of-statement orig done)) ((not (eq (current-column) (current-indentation))) (if (< 0 (abs (skip-chars-backward "^;
\n\f"))) (progn (setq done t) (back-to-indentation) (py-beginning-of-statement orig done)) (back-to-indentation) (setq done t) (py-beginning-of-statement orig done))) ((looking-at "[ ]*#") (skip-chars-backward "
\n\f") (setq done t) (py-beginning-of-statement orig done))) (if (and (looking-at "[ ]*#") (looking-back "^[ ]*")) nil (if (< (point) orig) (progn (setq erg (point))))) (if (and py-verbose-p (interactive-p)) (progn (message "%s" erg))) erg))
py-beginning-of-statement()
(char-after (py-beginning-of-statement))
(equal (char-after (py-beginning-of-statement)) 64)
(save-excursion (equal (char-after (py-beginning-of-statement)) 64))
(cond ((nth 4 pps) (py-fill-comment justify)) ((save-excursion (or (nth 3 pps) (equal (string-to-syntax "|") (syntax-after (point))) (looking-at py-string-delim-re)) (goto-char (point-min)) (while (and (progn (forward-paragraph) (< this-end (point))) (setq this-end (copy-marker (point)))) (py-fill-string justify style beg this-end) (goto-char this-end) (set (make-local-variable (quote py-fill-docstring-style)) nil)))) ((save-excursion (equal (char-after (py-beginning-of-statement)) 64)) (py-fill-decorator justify)) ((or (nth 1 pps) (looking-at "[([{]") (save-excursion (skip-syntax-forward "^(" (line-end-position)) (looking-at "[([{]"))) (py-fill-paren justify)) (t t))
(save-restriction (goto-char beg) (end-of-line) (setq pps (syntax-ppss)) (narrow-to-region beg end) (cond ((nth 4 pps) (py-fill-comment justify)) ((save-excursion (or (nth 3 pps) (equal (string-to-syntax "|") (syntax-after (point))) (looking-at py-string-delim-re)) (goto-char (point-min)) (while (and (progn (forward-paragraph) (< this-end ...)) (setq this-end (copy-marker ...))) (py-fill-string justify style beg this-end) (goto-char this-end) (set (make-local-variable (quote py-fill-docstring-style)) nil)))) ((save-excursion (equal (char-after (py-beginning-of-statement)) 64)) (py-fill-decorator justify)) ((or (nth 1 pps) (looking-at "[([{]") (save-excursion (skip-syntax-forward "^(" (line-end-position)) (looking-at "[([{]"))) (py-fill-paren justify)) (t t)))
(save-excursion (save-restriction (goto-char beg) (end-of-line) (setq pps (syntax-ppss)) (narrow-to-region beg end) (cond ((nth 4 pps) (py-fill-comment justify)) ((save-excursion (or (nth 3 pps) (equal (string-to-syntax "|") (syntax-after ...)) (looking-at py-string-delim-re)) (goto-char (point-min)) (while (and (progn ... ...) (setq this-end ...)) (py-fill-string justify style beg this-end) (goto-char this-end) (set (make-local-variable ...) nil)))) ((save-excursion (equal (char-after (py-beginning-of-statement)) 64)) (py-fill-decorator justify)) ((or (nth 1 pps) (looking-at "[([{]") (save-excursion (skip-syntax-forward "^(" (line-end-position)) (looking-at "[([{]"))) (py-fill-paren justify)) (t t))))
(let ((orig (copy-marker (point))) (beg (or start (if (use-region-p) (region-beginning) (py-beginning-of-paragraph-position)))) (end (copy-marker (or end (if (use-region-p) (region-end) (py-end-of-paragraph-position))))) pps (style (or style py-fill-docstring-style)) (this-end (point-min))) (save-excursion (save-restriction (goto-char beg) (end-of-line) (setq pps (syntax-ppss)) (narrow-to-region beg end) (cond ((nth 4 pps) (py-fill-comment justify)) ((save-excursion (or (nth 3 pps) (equal ... ...) (looking-at py-string-delim-re)) (goto-char (point-min)) (while (and ... ...) (py-fill-string justify style beg this-end) (goto-char this-end) (set ... nil)))) ((save-excursion (equal (char-after ...) 64)) (py-fill-decorator justify)) ((or (nth 1 pps) (looking-at "[([{]") (save-excursion (skip-syntax-forward "^(" ...) (looking-at "[([{]"))) (py-fill-paren justify)) (t t)))))
(or (fill-comment-paragraph justify) (let ((orig (copy-marker (point))) (beg (or start (if (use-region-p) (region-beginning) (py-beginning-of-paragraph-position)))) (end (copy-marker (or end (if (use-region-p) (region-end) (py-end-of-paragraph-position))))) pps (style (or style py-fill-docstring-style)) (this-end (point-min))) (save-excursion (save-restriction (goto-char beg) (end-of-line) (setq pps (syntax-ppss)) (narrow-to-region beg end) (cond ((nth 4 pps) (py-fill-comment justify)) ((save-excursion (or ... ... ...) (goto-char ...) (while ... ... ... ...))) ((save-excursion (equal ... 64)) (py-fill-decorator justify)) ((or (nth 1 pps) (looking-at "[([{]") (save-excursion ... ...)) (py-fill-paren justify)) (t t))))))
py-fill-paragraph(nil)