From: Mattias EngdegÄrd Date: Wed, 30 Nov 2022 12:12:38 +0000 (+0100) Subject: Sink python indent offset guessing to avoid test failure X-Git-Tag: emacs-29.0.90~1419 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=af1a99d53f2ac5017b7a016f1ef2bce57c28a5b0;p=emacs.git Sink python indent offset guessing to avoid test failure Call python-indent-guess-indent-offset late in the set-up of python-mode and python-ts-mode to make sure that the required other settings (of syntax-propetize-function in particular) have been carried out. This cures a python-test failure (bug#59477). * lisp/progmodes/python.el (python-base-mode): Move python-indent-guess-indent-offset call from here... (python-mode): ...to here... (python-ts-mode): ...and here. --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index acfee211358..fc80c755e43 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6584,9 +6584,6 @@ implementations: `python-mode' and `python-ts-mode'." (make-local-variable 'python-shell-internal-buffer) - (when python-indent-guess-indent-offset - (python-indent-guess-indent-offset)) - (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) ;;;###autoload @@ -6605,7 +6602,11 @@ implementations: `python-mode' and `python-ts-mode'." python-syntax-propertize-function) (setq-local imenu-create-index-function #'python-imenu-create-index) - (add-hook 'which-func-functions #'python-info-current-defun nil t)) + + (add-hook 'which-func-functions #'python-info-current-defun nil t) + + (when python-indent-guess-indent-offset + (python-indent-guess-indent-offset))) ;;;###autoload (define-derived-mode python-ts-mode python-base-mode "Python" @@ -6625,7 +6626,10 @@ implementations: `python-mode' and `python-ts-mode'." #'python-imenu-treesit-create-index) (setq-local treesit-defun-type-regexp (rx (or "function" "class") "_definition")) - (treesit-major-mode-setup))) + (treesit-major-mode-setup) + + (when python-indent-guess-indent-offset + (python-indent-guess-indent-offset)))) ;;; Completion predicates for M-x ;; Commands that only make sense when editing Python code