From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71083: [PATCH] ; Enhance the "python-shell-send-block" for convenience Date: Sat, 25 May 2024 11:03:49 +0300 Message-ID: <86sey6z5ay.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16508"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71083@debbugs.gnu.org To: Lin Sun , kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 25 10:05:05 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 1sAmOn-00045J-3t for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 May 2024 10:05:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAmOf-0005Gn-7q; Sat, 25 May 2024 04:04: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 1sAmOe-0005GQ-DI for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:04: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 1sAmOd-0002lP-CX for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:04:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sAmOk-00077w-OF for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 04:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2024 08:05: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.171662424627357 (code B ref 71083); Sat, 25 May 2024 08:05:02 +0000 Original-Received: (at 71083) by debbugs.gnu.org; 25 May 2024 08:04:06 +0000 Original-Received: from localhost ([127.0.0.1]:41963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAmNq-00077B-4C for submit@debbugs.gnu.org; Sat, 25 May 2024 04:04:06 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sAmNo-00076o-Hx for 71083@debbugs.gnu.org; Sat, 25 May 2024 04:04:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sAmNb-0002ZJ-Iu; Sat, 25 May 2024 04:03:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=z27EHwe5WmsroyT0mq41T0AaRx2SfoHg6vz3FzQhrqs=; b=D379af+ug9Uf ly9MntoKfqWZ5279AeQK0W3NNjQoyurD2U13W2ytfwyfuq+3cqYBqixn3K7TYgRH/JXKcsVf5GHNw aZkBrvsMyoldJplCQzpy5AunvLEFqmMo3NnoVkPENUJc/czS3wduh6PzxN7vm+it1yULwwlkyjPxf Okj7PBANQXoYxEoSustxibXKs5BkEB2o5NEcPaMWALncgx2mFEaHEdSGTCKH1bSCsN1BlqEtyOjf7 /CQdPzQd8On/DHBtj6/07z/JGrIoDW+1vILGHU9C+GaEyPzIv4B48wWizeIacwGixogeNrJK46ugK 49LO+nAHShtYXVu/qijB9w==; In-Reply-To: (message from Lin Sun on Mon, 20 May 2024 20:28:17 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285837 Archived-At: 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 >