From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#71083: [PATCH] ; Enhance the "python-shell-send-block" for convenience Date: Sat, 25 May 2024 17:49:30 +0900 Message-ID: References: <86sey6z5ay.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30583"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 71083@debbugs.gnu.org, Lin Sun To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 25 10:51:08 2024 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 1sAn7L-0007qf-I3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 May 2024 10:51:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAn7B-0004J4-KE; Sat, 25 May 2024 04:50:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAn7A-0004Ik-Hf for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:50:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sAn79-0004Hu-A2 for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:50:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sAn7G-0007VN-FU for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2024 08:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71083 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71083-submit@debbugs.gnu.org id=B71083.171662705128837 (code B ref 71083); Sat, 25 May 2024 08:51:02 +0000 Original-Received: (at 71083) by debbugs.gnu.org; 25 May 2024 08:50:51 +0000 Original-Received: from localhost ([127.0.0.1]:42156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAn75-0007V3-DA for submit@debbugs.gnu.org; Sat, 25 May 2024 04:50:51 -0400 Original-Received: from mail-pl1-f174.google.com ([209.85.214.174]:51505) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAn72-0007Ux-Jy for 71083@debbugs.gnu.org; Sat, 25 May 2024 04:50:49 -0400 Original-Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f333e7a669so28418265ad.3 for <71083@debbugs.gnu.org>; Sat, 25 May 2024 01:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716626975; x=1717231775; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=hQuRknTJtidK3gb5vWK3h1gNUBftLfKn9E81kBFHO+g=; b=OV9lPxXb/JgFDytcJ1DEspepJeIRpHE4MfzZQXtpLoD79SNIqJyQZ/H2vJC0dUPu3f wkVPhb4Ldg4Jat2/i6Spj6ToJMLb4RCQxjNhdDQt510yPKvS7jyTWSrPO+HMT8+2iAYX 5NQQomORReYhZQCOxNOgJUXEITqYyTym4ajRB2L6Y6uswsAXNTpGKRmKbVLuMiDiuSFM xYW3mFnjkea28HUBrMqKZlruXTDXVzcxKfMfu+pIeDGVY5g+TV0hOHljfr3D0COGU/we 8rFW3bEYukB7KLdO4tIh79x97uSuiKjNkdoFm+6oCGNStvPvjiGmcARLBmyCquDqpsWB T47g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716626975; x=1717231775; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hQuRknTJtidK3gb5vWK3h1gNUBftLfKn9E81kBFHO+g=; b=LD9e7acNSzLtwdVzdX3OWbm2LX1XW5kkbr2nNyf6CApN9FmnxJNBNdY+uOp5ih+YPG h6KJFJjX1SW9CLprRgc2ZUc6zQgVVtHkBeLb8uunOAuUBsXWIOvV4xfpIt4B9ppRef0m Xxi1KI8UWJu1qRDO/pyBa2+6og+xRRP/7y8iFzEPLZm25bl6kfkXA9M3SO8WYPPNboAQ 6tdVjgROclSaMcZ08u2U/Tf3tEd3kjc2GQ7/ModoHY5mIKNRLZOhSh6ENZDnEMSzl/A1 XFTt9HOYp4aWT4ZLcjyXcsM9ofSg0E12BBbyB4CnPZO11wX2ChAT0rYLVxU+IJZaHiB7 rHbg== X-Forwarded-Encrypted: i=1; AJvYcCWSXswzmh6f0Sy+DqKe3XksDs7H0ehwixeX0SMg7Jk1p5i9tgH+ras9n53g1JR+eTcJJVmJu7EzggBCfCo8czV5mU5irFE= X-Gm-Message-State: AOJu0YxIfSV8J032chybu/0pNw0HY6ZYD15GUdWZJIojvZ5t5RM6W6/P QP6Q3DuEKWZP/V7o5RP1Y5S/IxhZJUPEwswGVn8pIaV2EyC7YPhJ X-Google-Smtp-Source: AGHT+IG3WBvyc2Itj5igjK1slWmu+RMvIDejjLJol0Azsb94mNDno0FMBHy1kcUBibHyxpeV777ItQ== X-Received: by 2002:a17:902:d2cd:b0:1f4:5685:b146 with SMTP id d9443c01a7336-1f45685b4c7mr41191965ad.37.1716626975161; Sat, 25 May 2024 01:49:35 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f44c96fd7esm26113705ad.157.2024.05.25.01.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 01:49:34 -0700 (PDT) In-Reply-To: <86sey6z5ay.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285842 Archived-At: Eli Zaretskii wrote: > Any comments on the proposed patch? > > > From: Lin Sun > > Date: Mon, 20 May 2024 20:28:17 +0000 > > > > This patch tries to make `python-shell-send-block' more convenient. > > > > I had added the function `python-shell-send-block' twenty days ago in > > bug#70609, it will send code block with header by default, and a > > prefix "C-u" to call the function will send block without header. > > > > And I received some feedback that sending a block without a header > > should be a more used one. > > > > Many python blocks begin with "if condition", and users may want to > > send the block without its condition header to try different condition > > branches. > > > > So this patch will make sending block without header to be the default > > behavior, and a prefix "C-u" will make the function to send block with > > header. > > > > Please help review this minor change. Thanks > > > > > > From 7eefbf3e4de925c211e483a809d0f8d94e8d17f0 Mon Sep 17 00:00:00 2001 > > From: Lin Sun > > Date: Mon, 20 May 2024 06:55:31 +0000 > > Subject: [PATCH] ; Enhance the "python-shell-send-block" for convenience > > > > * lisp/progmodes/python.el (python-shell-send-block): > > The "python-shell-send-block" will send block without header defaultly. > > * lisp/progmodes/python.el: Update test case. > > --- > > lisp/progmodes/python.el | 4 ++-- > > test/lisp/progmodes/python-tests.el | 4 ++-- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > > index 7f28f583543..9ec198da79a 100644 > > --- a/lisp/progmodes/python.el > > +++ b/lisp/progmodes/python.el > > @@ -4149,14 +4149,14 @@ interactively." > > "Send the block at point to inferior Python process. > > The block is delimited by `python-nav-beginning-of-block' and > > `python-nav-end-of-block'. If optional argument ARG is non-nil > > -(interactively, the prefix argument), send the block body without > > +(interactively, the prefix argument), send the block body with > > its header. If optional argument MSG is non-nil, force display > > of a user-friendly message if there's no process running; this > > always happens interactively." > > (interactive (list current-prefix-arg t)) > > (let ((beg (save-excursion > > (when (python-nav-beginning-of-block) > > - (if (null arg) > > + (if arg > > (beginning-of-line) > > (python-nav-end-of-statement) > > (beginning-of-line 2))) > > diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el > > index f50797953c3..803008db8a3 100644 > > --- a/test/lisp/progmodes/python-tests.el > > +++ b/test/lisp/progmodes/python-tests.el > > @@ -7476,7 +7476,7 @@ print('current 3')" > > (goto-char (point-min)) > > (should-error (python-shell-send-block) :type 'user-error) > > (forward-line) > > - (python-shell-send-block) > > + (python-shell-send-block t) ;; send block with header > > (python-tests-shell-wait-for-prompt) > > (python-shell-with-shell-buffer > > (goto-char (point-min)) > > @@ -7485,7 +7485,7 @@ print('current 3')" > > (should (re-search-forward "current 2" nil t)) > > (should-not (re-search-forward "current 3" nil t))) > > (forward-line) > > - (python-shell-send-block t) ;; send block body only > > + (python-shell-send-block) ;; send block body only > > (python-tests-shell-wait-for-prompt) > > (python-shell-with-shell-buffer > > ;; should only 1 line output from the block body > > -- > > 2.20.5 > > As for the default behavior of `python-shell-send-block' I am fine with either. "send block without header defaultly." in the commit message would be better for "send block without header by default." I noticed two Flymake diagnostics regarding `python-shell-send-block'. - Open parenthesis in column 0 should be escaped - Error messages should *not* end with a period It would be nice to resolve them.