From 518ff50f7a245f437576c5f7e716be9cba336287 Mon Sep 17 00:00:00 2001 From: Rolf Ade Date: Sun, 13 Oct 2019 05:18:36 +0200 Subject: [PATCH] TCL indentation fix outside functions * lisp/progmodes/tcl.el (tcl-calculate-indent): Indent code correctly outside of function definitions (bug#23565). Copyright-paperwork-exempt: yes --- lisp/progmodes/tcl.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 0fd3d6d1bf4..0788725055e 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -815,9 +815,14 @@ Returns nil if line starts inside a string, t if in a comment." state containing-sexp found-next-line) - (if parse-start - (goto-char parse-start) - (beginning-of-defun)) + (cond + (parse-start + (goto-char parse-start)) + ((not (beginning-of-defun)) + ;; If we're not in a function, don't use + ;; `tcl-beginning-of-defun-function'. + (let ((beginning-of-defun-function nil)) + (beginning-of-defun)))) (while (< (point) indent-point) (setq parse-start (point)) (setq state (parse-partial-sexp (point) indent-point 0)) -- 2.39.5