emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 af1a99d53f 1/3: Sink python indent offset guessing to avoid tes


From: Mattias Engdegård
Subject: emacs-29 af1a99d53f 1/3: Sink python indent offset guessing to avoid test failure
Date: Wed, 30 Nov 2022 07:26:18 -0500 (EST)

branch: emacs-29
commit af1a99d53f2ac5017b7a016f1ef2bce57c28a5b0
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    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.
---
 lisp/progmodes/python.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index acfee21135..fc80c755e4 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]