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 08:42:51 +0200 Message-ID: <87r1dry7x0.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> 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="39319"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "50514@debbugs.gnu.org" <50514@debbugs.gnu.org>, Lars Ingebrigtsen To: "Barton, Mark" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 14 08:44:25 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 1mQ2B7-000A72-BB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Sep 2021 08:44:25 +0200 Original-Received: from localhost ([::1]:47766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQ2B6-0001RL-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Sep 2021 02:44:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQ2Am-0001Qi-4F for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 02:44:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQ2Ak-0007mu-8x for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 02:44:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQ2Ak-000743-5R for bug-gnu-emacs@gnu.org; Tue, 14 Sep 2021 02:44: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 06:44: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.163160178427077 (code B ref 50514); Tue, 14 Sep 2021 06:44:02 +0000 Original-Received: (at 50514) by debbugs.gnu.org; 14 Sep 2021 06:43:04 +0000 Original-Received: from localhost ([127.0.0.1]:47349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQ29n-00072f-Mk for submit@debbugs.gnu.org; Tue, 14 Sep 2021 02:43:03 -0400 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:44979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQ29m-00072C-E3 for 50514@debbugs.gnu.org; Tue, 14 Sep 2021 02:43:02 -0400 Original-Received: by mail-wr1-f41.google.com with SMTP id d6so18368600wrc.11 for <50514@debbugs.gnu.org>; Mon, 13 Sep 2021 23:43:02 -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=pXaOHkQlwMhVd9sRYiAo81cbCJZQUuFfe+8IeiVWtRU=; b=XXS/J2qKAWJWavbqtvlg7Acf1VTZZDWC6FE3mxpWcbttIAi1z4lZzoZgouJ0TmvzQD EPtit50zaeCAdWlAVT0VJmLTRwfceMAA+rYJ6VzNL2WK9VGyXIctRs3iNxdz2YYsJ1U+ 6mB+nxFdL8bxRjx9Uws++pSeU+fYsgob99NTZ6xSiwlJkH2Picb7HhmQ0UI/n3a3kxcl EUm6IL1BcYV34bEWZNBr2vX99mrTF2YtH97wH+eNRm26Au8itQ22ahTzOqqXqMidNt9H Fy7TJGQvnmEDDp759DDAvGKh2QKJZZIyXpSE80POZHjx20qVF9wcufACDlpzS/Jh+DCr MADA== 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=pXaOHkQlwMhVd9sRYiAo81cbCJZQUuFfe+8IeiVWtRU=; b=AN5cufC7KTdohLRPlJvKFz8fKtWRgAjXm1q26+uvZwq5YU+LJ/R3PiX1Q5QUiYNmS0 wz8xCX0zOwPJHXERFk7WWsFUOggPGnxKl5meXzsQwQltTyYbJO7Nt6+JVytLrT4rHUkb ojJ/pNx2zU2nxG1yJ70gQAlRbCQ+rpfZ/IJzkstREabnIUhX1lWIYYA6G1VO2QiPb4l3 h2Yx4fp8EoFALbbZ/jvA5oZAb3xJ/kQwQx9liYXFQ6qN7xFhW1Kewn0zeR4IL1/vuFgz 44WyW4j86z6GA6E8vxQxOZ2rGtM1B68N16yEe5qLOJZVhn+4gPPTMOTRKq/uYQuO1Has CfFw== X-Gm-Message-State: AOAM532r9Ze1o38iGrxJiDDIl1yOxREJxWf3S9pN2uUM6liIKYrBt5bT FuK9ST0xnvdCXBDvEm79CkanrmlWFOY= X-Google-Smtp-Source: ABdhPJx2nUAOVXLXSIjxscLmu3zUl7zuF8g0EqIqRSPECOCJrSvXUdN7hrnpTca90J7polB52L3dKw== X-Received: by 2002:adf:82cf:: with SMTP id 73mr17459273wrc.366.1631601776314; Mon, 13 Sep 2021 23:42:56 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::3c3e]) by smtp.gmail.com with ESMTPSA id t126sm184272wma.4.2021.09.13.23.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 23:42:55 -0700 (PDT) In-Reply-To: <73383502-159B-4BD9-8836-6C8A534A7063@disney.com> (Mark Barton's message of "Sun, 12 Sep 2021 20:04:51 +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:214277 Archived-At: --=-=-= Content-Type: text/plain Hi Mark, After removing the patch to ob-python.el and applying the attached patch to python.el, could you please test that your notebooks work again? This will probably not change the independent initialization problem that you describe (but it might, who knows). If you want to help me understanding that part, you can do M-x trace-function RET python-shell-send-string-no-output M-x trace-function RET python-shell-output-filter-buffer M-x trace-function RET python-shell-completion-native-get-completions and send the result printed to 'trace-buffer'. 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 --=-=-=--