From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50514: 28.0.50; org inline call to python src block req C-g to break Date: Tue, 14 Sep 2021 21:36:23 +0200 Message-ID: <87k0jjq79k.fsf@gmail.com> References: <24B9F777-2B69-45FD-ADBB-11E7A18F7A9A@disney.com> <87wnnnjlav.fsf@gmail.com> <871r5u1e3m.fsf@gmail.com> <61CB9513-0EEC-4F46-90D6-1D208BBADFA1@disney.com> <87pmteb1ef.fsf@gmail.com> <21C76818-63E5-4DC9-A60D-2BEF33813A18@disney.com> <73383502-159B-4BD9-8836-6C8A534A7063@disney.com> <87r1dry7x0.fsf@gmail.com> <32AF1DCB-F81A-4FB7-8EB2-31B483E5E468@disney.com> <87sfy7qadr.fsf@gmail.com> <073CC0D1-9900-4613-87E8-D69EA1C11623@disney.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27718"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "Barton, Mark" , "50514@debbugs.gnu.org" <50514@debbugs.gnu.org> To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 14 21:37:23 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQEF9-00075Y-1s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Sep 2021 21:37:23 +0200 Original-Received: from localhost ([::1]:60400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQEF7-0001YY-Mj for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Sep 2021 15:37:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQEEp-0001WV-HV for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 15:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQEEo-0005bz-8w for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 15:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQEEo-0000X0-3W for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 15:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Sep 2021 19:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50514 X-GNU-PR-Package: emacs Original-Received: via spool by 50514-submit@debbugs.gnu.org id=B50514.16316481942002 (code B ref 50514); Tue, 14 Sep 2021 19:37:02 +0000 Original-Received: (at 50514) by debbugs.gnu.org; 14 Sep 2021 19:36:34 +0000 Original-Received: from localhost ([127.0.0.1]:50223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQEEL-0000WE-V6 for submit@debbugs.gnu.org; Tue, 14 Sep 2021 15:36:34 -0400 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:43910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQEEK-0000Vy-0H for 50514@debbugs.gnu.org; Tue, 14 Sep 2021 15:36:32 -0400 Original-Received: by mail-wr1-f45.google.com with SMTP id b6so16304wrh.10 for <50514@debbugs.gnu.org>; Tue, 14 Sep 2021 12:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9L3l/BRcdhos7v6yxSeRv8nVe5GMG3jwH9hD1+1u6nU=; b=Gq4cTBzXUymlJhkJcL8Nh9jT5zGdpwlbv0TIFKFXD+ih31je0oSOprzm6rKlWXCnBq sGXCf95P8iN/sMJOMMVR2cxULWt9+5wnoNlkAyXAjsOh2vPH87Ar5LKQLjSfL4Fc3UzJ Up+i6jVCALtIUyULqRl6E4EY1QJ0rF6TkiVrjkHKN+1H1QvHGREVrjOThf3xrBK9RyPT BJQzAwHswjqFAz+bj61t0iouD9fn/pLwrj040hdzfJVno7+Mx9yIa24MaiMuGuExZoCi W7kVMISOGf6aG1be7NpmNGl3ieccMUXbpzeScwSKpusf9uDBtw7sJwP23Upyf/rxF7rK sqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9L3l/BRcdhos7v6yxSeRv8nVe5GMG3jwH9hD1+1u6nU=; b=yT+NvmRQqX0TnKzIDAV7qeIfDiB0QJBGzdgt3vYR0wNyieE/JXUSEWAdbRTRg/pRc/ m6QyWeV+M2FpdTft/N2iMjIP6JHt8VNX1GFSj0wDzq9paxl+b+eaFalVWTM0SnTbL4EQ 8JCdycNskws+Uzy1ANzHDgWax0BQsRuQTyE3KBoyKCabnhbVM9svLcpQqXs7/nkXyKCg Cqi1uIGjZ5zMMIs7Z5Io6eqZ/EQsWUofqEF5z3UyuZfKe3gSQ/SDGpO03RBLAZ02tKxf bks4X7ZhS+yvFjpxlJUdPoAEI/TB3TA/8IuZWqT9gLikw9cTKgS+6ex9oSXaNJA4QVe2 d1Lg== X-Gm-Message-State: AOAM533MlwiudQ9JIOEA9GBRk/qxDQ9W/fCgY/vcZNcYiWlSfYMzS18M MzcgMisHEpheAbxkjjFPofGiEuno3WI= X-Google-Smtp-Source: ABdhPJwbzYyRZBJRBXjlfShos9vzmGPViLzm/EX7PfebWlOP+eyg+a5vxmqRrDPfDpfgp1/19HcBNA== X-Received: by 2002:a5d:69c6:: with SMTP id s6mr871641wrw.157.1631648185828; Tue, 14 Sep 2021 12:36:25 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::3c3e]) by smtp.gmail.com with ESMTPSA id x5sm1786703wmk.32.2021.09.14.12.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 12:36:25 -0700 (PDT) In-Reply-To: <073CC0D1-9900-4613-87E8-D69EA1C11623@disney.com> (Mark Barton's message of "Tue, 14 Sep 2021 19:25:46 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214337 Archived-At: --=-=-= Content-Type: text/plain Lars, can you install the attached patch, which solves the parts of this issue which originate in my recent changes? The patch also does the correct thing w.r.t. the text fields in the comint, something I was unaware of until yesterday. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Python-shell-rearrange-printing-of-newline-before-ou.patch >From 096a3cb45baa4ff954c19c1d2d34dd86757ef4f5 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Tue, 14 Sep 2021 05:31:45 +0200 Subject: [PATCH] Python shell: rearrange printing of newline before output * progmodes/python.el (python-shell-output-filter-in-progress, python-shell-output-filter-buffer): Move defvars to avoid compiler warnings. (python-shell-eval-setup-code): Don't print a newline in __PYTHON_EL_eval. (python-shell-send-string): Insert newline before output when applicable, --- lisp/progmodes/python.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d9fc5c5009..fae350dea2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2189,6 +2189,9 @@ python-shell-compilation-regexp-alist :type '(alist regexp) :group 'python) +(defvar python-shell-output-filter-in-progress nil) +(defvar python-shell-output-filter-buffer nil) + (defmacro python-shell--add-to-path-with-priority (pathvar paths) "Modify PATHVAR and ensure PATHS are added only once at beginning." `(dolist (path (reverse ,paths)) @@ -2821,7 +2824,6 @@ python-shell-eval-setup-code from __builtin__ import compile, eval, globals else: from builtins import compile, eval, globals - sys.stdout.write('\\n') try: p, e = ast.parse(source, filename), None except SyntaxError: @@ -3162,6 +3164,11 @@ python-shell-send-string (python-shell--encode-string string) (python-shell--encode-string (or (buffer-file-name) ""))))) + (unless python-shell-output-filter-in-progress + (with-current-buffer (process-buffer process) + (save-excursion + (goto-char (process-mark process)) + (insert-before-markers "\n")))) (if (or (null (process-tty-name process)) (<= (string-bytes code) (or (bound-and-true-p comint-max-line-length) @@ -3172,9 +3179,6 @@ python-shell-send-string (file-name (or (buffer-file-name) temp-file-name))) (python-shell-send-file file-name process temp-file-name t))))) -(defvar python-shell-output-filter-in-progress nil) -(defvar python-shell-output-filter-buffer nil) - (defun python-shell-output-filter (string) "Filter used in `python-shell-send-string-no-output' to grab output. STRING is the output received to this point from the process. -- 2.31.1 --=-=-=--