From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 59477@debbugs.gnu.org
Subject: bug#59477: python-tests fail without tree-sitter
Date: Sun, 27 Nov 2022 14:07:13 +0100 [thread overview]
Message-ID: <0F939218-834F-43D1-8F0B-D812848F1CB3@gmail.com> (raw)
In-Reply-To: <FC02DCBA-26AA-41EF-A62C-B93C2FB7CF2D@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 722 bytes --]
26 nov. 2022 kl. 23.18 skrev Yuan Fu <casouri@gmail.com>:
> 1. Setting require-final-newline to t doesn’t work
As expected; it's not relevant here.
> 2. If I change with-temp-buffer to with-current-buffer (get-buffer-create "*test*”), the problem disappears, the newlines is not dropped
Yes, because you then reuse an old buffer that already has local variables set.
I'm tempted to push this patch that sinks the call to python-indent-guess-indent-offset so that it comes last in mode initialisation, as discussed in my previous message. Any objection?
As mentioned, I'm not sure it really addresses the root problem but at least it should be no worse than before the changes that broke the test.
[-- Attachment #2: python-mode.diff --]
[-- Type: application/octet-stream, Size: 1395 bytes --]
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 @@ python-base-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 @@ python-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 @@ 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
next prev parent reply other threads:[~2022-11-27 13:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 10:13 bug#59477: python-tests fail without tree-sitter Mattias Engdegård
2022-11-23 2:40 ` Yuan Fu
2022-11-23 22:00 ` Yuan Fu
2022-11-24 6:45 ` Eli Zaretskii
2022-11-25 16:50 ` Mattias Engdegård
2022-11-26 22:18 ` Yuan Fu
2022-11-27 13:07 ` Mattias Engdegård [this message]
2022-11-30 13:41 ` Mattias Engdegård
2022-12-04 7:51 ` Yuan Fu
2022-11-27 13:16 ` Mattias Engdegård
2022-11-27 14:48 ` kobarity
2022-11-28 10:01 ` Mattias Engdegård
2022-11-28 15:18 ` kobarity
2022-11-28 19:22 ` Mattias Engdegård
2022-11-28 10:18 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0F939218-834F-43D1-8F0B-D812848F1CB3@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=59477@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.