I'm also seeing this when pressing RET in a docstring. This is a debug trace: Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) <(nil 6633) (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat)) (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if ... ... ...)) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment (looking-back "^[ ]*"))) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and (eq (point) orig) (looking-at "[ ]*\\()\\)[ ]*$")) (setq closing (match-beginning 0))) (save-excursion (goto-char (nth 1 pps)) (setq this-line (py-count-lines)) (cond ((< 0 ...) (if ... ... ...)) (t (back-to-indentation) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat))))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char (+ py-lhs-inbound-indent (nth 1 pps))) (when (looking-at "[ ]+") (goto-char (match-end 0))) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ (current-indentation) py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 (current-indentation)))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep (quote xemacs)) (nth 1 (parse-partial-sexp (point-min) (point))) (nth 1 (syntax-ppss))))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg (py-go-to-keyword py-block-or-clause-re -1)) (ignore-errors (< orig (py-end-of-block-or-clause)))))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation))) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 ...) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char ...)) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment (looking-back "^[ ]*"))) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and (eq ... orig) (looking-at "[ ]*\\()\\)[ ]*$")) (setq closing (match-beginning 0))) (save-excursion (goto-char (nth 1 pps)) (setq this-line (py-count-lines)) (cond (... ...) (t ... ... ...)))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char (+ py-lhs-inbound-indent ...)) (when (looking-at "[ ]+") (goto-char ...)) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ (current-indentation) py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 (current-indentation)))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep (quote xemacs)) (nth 1 (parse-partial-sexp ... ...)) (nth 1 (syntax-ppss))))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg (py-go-to-keyword py-block-or-clause-re -1)) (ignore-errors (< orig ...))))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< ... ...) (current-indentation) (ignore-errors ...) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment ...)) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and ... ...) (setq closing ...)) (save-excursion (goto-char ...) (setq this-line ...) (cond ... ...))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char ...) (when ... ...) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ ... py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 ...))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep ...) (nth 1 ...) (nth 1 ...)))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg ...) (ignore-errors ...)))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent) (save-restriction (widen) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if ... ... ... ... ... ...)) (ignore-errors (goto-char ...)) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char ...) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line ...) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq ... ...))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside ...) (when ... ...) (save-excursion ... ... ...)) ((and ... line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn ... ... ...)) (t (goto-char ...) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 ...) (py-fetch-previous-indent orig) (if ... 5 ...)))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car ...)) ((looking-at py-except-re) (car ...)) ((looking-at py-else-re) (car ...)) ((looking-at py-elif-re) (car ...)))) ((looking-at py-block-or-clause-re) (cond ((eq origline ...) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ ... ...)))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if ... ... ...))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq ... orig) (progn ... ...) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and ... ...))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent)) (save-excursion (save-restriction (widen) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline ...)) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))) ((and (bobp) (not ...)) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline ...) (progn ... ... ... ...) (ignore-errors ...) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not ...)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline ...) (progn ... ... ... ...) (goto-char ...) (if ... ... ... ...))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not ...)) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond (... ... ...) (... ... ...) (... ...) (t ... ...))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line ...) (if ... ... ...))) ((looking-at py-no-outdent-re) (if (eq ... origline) (progn ... ... ...) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq ... origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq ... origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline ...)) (cond (... ...) (... ...) (... ...) (... ...))) ((looking-at py-block-or-clause-re) (cond (... ... ...) (t ...))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< ... ...)) (back-to-indentation) (unless line (setq inside ...)) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if ... ... ... ...))) ((py-statement-opens-block-p) (if (< ... origline) (+ ... ...) (py-compute-indentation orig origline closing line inside t))) ((and (< ... origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline ...) (save-excursion ...)) (+ (car erg) (if py-smart-indentation ... py-indent-offset))) ((and (eq origline ...) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent))) py-compute-indentation() (indent-to-column (py-compute-indentation)) (setq erg (indent-to-column (py-compute-indentation))) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (if (< ci (current-column)) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (beginning-of-line) (insert-char 10 1) (insert (make-string (setq erg (py-compute-indentation)) 32)) (when (looking-at "\\([ ]+\\)") (delete-region (match-beginning 1) (match-end 1)))) (let ((ci (current-indentation)) erg) (if (< ci (current-column)) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (beginning-of-line) (insert-char 10 1) (insert (make-string (setq erg (py-compute-indentation)) 32)) (when (looking-at "\\([ ]+\\)") (delete-region (match-beginning 1) (match-end 1)))) (when (and (looking-at "[ ]+") (nth 1 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss)))) (delete-region (match-beginning 0) (match-end 0))) (when (interactive-p) (message "%s" erg)) erg) ad-Orig-py-newline-and-indent() py-newline-and-indent() call-interactively(py-newline-and-indent nil nil) recursive-edit() debug(error (wrong-type-argument number-or-marker-p nil)) <(nil 6609) (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat)) (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 (if ... ... ...)) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment (looking-back "^[ ]*"))) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and (eq (point) orig) (looking-at "[ ]*\\()\\)[ ]*$")) (setq closing (match-beginning 0))) (save-excursion (goto-char (nth 1 pps)) (setq this-line (py-count-lines)) (cond ((< 0 ...) (if ... ... ...)) (t (back-to-indentation) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat))))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char (+ py-lhs-inbound-indent (nth 1 pps))) (when (looking-at "[ ]+") (goto-char (match-end 0))) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ (current-indentation) py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 (current-indentation)))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep (quote xemacs)) (nth 1 (parse-partial-sexp (point-min) (point))) (nth 1 (syntax-ppss))))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg (py-go-to-keyword py-block-or-clause-re -1)) (ignore-errors (< orig (py-end-of-block-or-clause)))))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation))) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< (nth 2 ...) (line-beginning-position)) (current-indentation) (ignore-errors (goto-char ...)) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment (looking-back "^[ ]*"))) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and (eq ... orig) (looking-at "[ ]*\\()\\)[ ]*$")) (setq closing (match-beginning 0))) (save-excursion (goto-char (nth 1 pps)) (setq this-line (py-count-lines)) (cond (... ...) (t ... ... ...)))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char (+ py-lhs-inbound-indent ...)) (when (looking-at "[ ]+") (goto-char ...)) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ (current-indentation) py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 (current-indentation)))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep (quote xemacs)) (nth 1 (parse-partial-sexp ... ...)) (nth 1 (syntax-ppss))))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg (py-go-to-keyword py-block-or-clause-re -1)) (ignore-errors (< orig ...))))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if (< ... ...) (current-indentation) (ignore-errors ...) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) (ignore-errors (goto-char (nth 2 pps))) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char (nth 8 pps)) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line (or py-indent-honors-inline-comment ...)) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq (line-beginning-position) (point-min)))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside (not line)) (when (and ... ...) (setq closing ...)) (save-excursion (goto-char ...) (setq this-line ...) (cond ... ...))) ((and (not inside) line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn (goto-char ...) (when ... ...) (current-column))) (t (goto-char (nth 1 pps)) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 (- origline this-line)) (py-fetch-previous-indent orig) (if (looking-at "from +\\([^ \n]+\\) +import") 5 (+ ... py-continuation-offset))))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car (py-clause-lookup-keyword py-finally-re -1))) ((looking-at py-except-re) (car (py-clause-lookup-keyword py-except-re -1))) ((looking-at py-else-re) (car (py-clause-lookup-keyword py-else-re -1 ...))) ((looking-at py-elif-re) (car (py-clause-lookup-keyword py-elif-re -1))))) ((looking-at py-block-or-clause-re) (cond ((eq origline (py-count-lines)) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if (featurep ...) (nth 1 ...) (nth 1 ...)))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq (point) orig) (progn (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and (setq erg ...) (ignore-errors ...)))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent) (save-restriction (widen) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline (py-count-lines))) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((and (bobp) (not (py-statement-opens-block-p))) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline (py-count-lines)) (progn (forward-line -1) (end-of-line) (skip-chars-backward " \n\f") (if ... ... ... ... ... ...)) (ignore-errors (goto-char ...)) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not (bobp))) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline (py-count-lines)) (progn (goto-char ...) (py-line-backward-maybe) (skip-chars-backward " ") (py-compute-indentation orig origline closing line inside repeat)) (goto-char (nth 8 pps)) (if (and line ...) (current-column) (forward-char -1) (py-compute-indentation orig origline closing line inside repeat)))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not (eq ... ...))) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond ((and inside ...) (when ... ...) (save-excursion ... ... ...)) ((and ... line) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((not inside) (progn ... ... ...)) (t (goto-char ...) (py-compute-indentation orig origline closing line inside repeat)))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line (py-count-lines)) (if (< 1 ...) (py-fetch-previous-indent orig) (if ... 5 ...)))) ((looking-at py-no-outdent-re) (if (eq (py-count-lines) origline) (progn (back-to-indentation) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside repeat)) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq (py-count-lines) origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq (py-count-lines) origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline (py-count-lines))) (cond ((looking-at py-finally-re) (car ...)) ((looking-at py-except-re) (car ...)) ((looking-at py-else-re) (car ...)) ((looking-at py-elif-re) (car ...)))) ((looking-at py-block-or-clause-re) (cond ((eq origline ...) (py-line-backward-maybe) (py-compute-indentation orig origline closing line inside t)) (t (+ ... ...)))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< (current-indentation) (current-column))) (back-to-indentation) (unless line (setq inside (if ... ... ...))) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if (eq ... orig) (progn ... ...) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)))) ((py-statement-opens-block-p) (if (< (py-count-lines) origline) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation)) (py-compute-indentation orig origline closing line inside t))) ((and (< (py-count-lines) origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline (py-count-lines)) (save-excursion (and ... ...))) (+ (car erg) (if py-smart-indentation (py-guess-indent-offset nil orig) py-indent-offset))) ((and (eq origline (py-count-lines)) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent)) (save-excursion (save-restriction (widen) (let* ((orig (or orig (point))) (origline (or origline (py-count-lines))) (closing closing) (line line) (pps (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss))) (repeat repeat) (inside inside) erg indent this-line) (unless repeat (setq inside (nth 1 pps)) (setq repeat t)) (setq indent (cond ((and (bobp) (eq origline ...)) (current-indentation)) ((and (bobp) (py-statement-opens-block-p)) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))) ((and (bobp) (not ...)) (current-indentation)) ((and (nth 3 pps) (nth 8 pps)) (if (eq origline ...) (progn ... ... ... ...) (ignore-errors ...) (py-line-backward-maybe) (back-to-indentation) (py-compute-indentation orig origline closing line inside repeat))) ((and (looking-at "\"\"\"\\|'''") (not ...)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((nth 8 pps) (if (eq origline ...) (progn ... ... ... ...) (goto-char ...) (if ... ... ... ...))) ((and (looking-at "[ ]*#") (looking-back "^[ ]*") (not ...)) (forward-line -1) (end-of-line) (setq line t) (py-compute-indentation orig origline closing line inside repeat)) ((nth 1 pps) (cond (... ... ...) (... ... ...) (... ...) (t ... ...))) ((py-preceding-line-backslashed-p) (progn (py-beginning-of-statement) (setq this-line ...) (if ... ... ...))) ((looking-at py-no-outdent-re) (if (eq ... origline) (progn ... ... ...) (current-indentation))) ((and (looking-at py-block-closing-keywords-re) (eq ... origline)) (py-beginning-of-block-or-clause) (+ (if py-smart-indentation ... py-indent-offset) (current-indentation))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block-or-clause nil (current-indentation)) (current-indentation)) ((and (looking-at py-elif-re) (eq ... origline)) (py-line-backward-maybe) (car (py-clause-lookup-keyword py-elif-re -1))) ((and (looking-at py-clause-re) (eq origline ...)) (cond (... ...) (... ...) (... ...) (... ...))) ((looking-at py-block-or-clause-re) (cond (... ... ...) (t ...))) ((looking-at py-block-closing-keywords-re) (py-beginning-of-block) (current-indentation)) ((and (< ... ...)) (back-to-indentation) (unless line (setq inside ...)) (py-compute-indentation orig origline closing line inside repeat)) ((not (py-beginning-of-statement-p)) (if (bobp) (current-column) (if ... ... ... ...))) ((py-statement-opens-block-p) (if (< ... origline) (+ ... ...) (py-compute-indentation orig origline closing line inside t))) ((and (< ... origline) (looking-at py-assignment-re)) (current-indentation)) ((looking-at py-assignment-re) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) ((and (eq origline ...) (save-excursion ...)) (+ (car erg) (if py-smart-indentation ... py-indent-offset))) ((and (eq origline ...) (py-beginning-of-statement-p)) (py-beginning-of-statement) (py-compute-indentation orig origline closing line inside repeat)) (t (current-indentation)))) (when (interactive-p) (message "%s" indent)) indent))) py-compute-indentation() (indent-to-column (py-compute-indentation)) (setq erg (indent-to-column (py-compute-indentation))) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (if (< ci (current-column)) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (beginning-of-line) (insert-char 10 1) (insert (make-string (setq erg (py-compute-indentation)) 32)) (when (looking-at "\\([ ]+\\)") (delete-region (match-beginning 1) (match-end 1)))) (let ((ci (current-indentation)) erg) (if (< ci (current-column)) (progn (newline) (setq erg (indent-to-column (py-compute-indentation)))) (beginning-of-line) (insert-char 10 1) (insert (make-string (setq erg (py-compute-indentation)) 32)) (when (looking-at "\\([ ]+\\)") (delete-region (match-beginning 1) (match-end 1)))) (when (and (looking-at "[ ]+") (nth 1 (if (featurep (quote xemacs)) (parse-partial-sexp (point-min) (point)) (syntax-ppss)))) (delete-region (match-beginning 0) (match-end 0))) (when (interactive-p) (message "%s" erg)) erg) ad-Orig-py-newline-and-indent() py-newline-and-indent() call-interactively(py-newline-and-indent)