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: Sun, 26 May 2024 09:35:49 +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=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17148"; 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, Eli Zaretskii To: Lin Sun Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 26 02:38:24 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 1sB1u3-0004Jx-Ju for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 May 2024 02:38:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sB1th-0003ez-89; Sat, 25 May 2024 20:38:01 -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 1sB1ta-0003e0-PQ for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 20:37:54 -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 1sB1ta-0005ET-EB for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 20:37:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sB1th-0001DU-SL for bug-gnu-emacs@gnu.org; Sat, 25 May 2024 20:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 May 2024 00:38:01 +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.1716683830373 (code B ref 71083); Sun, 26 May 2024 00:38:01 +0000 Original-Received: (at 71083) by debbugs.gnu.org; 26 May 2024 00:37:10 +0000 Original-Received: from localhost ([127.0.0.1]:45460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sB1sr-00005Q-9j for submit@debbugs.gnu.org; Sat, 25 May 2024 20:37:09 -0400 Original-Received: from mail-pj1-f42.google.com ([209.85.216.42]:59731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sB1so-0008LI-Aw for 71083@debbugs.gnu.org; Sat, 25 May 2024 20:37:07 -0400 Original-Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2bf5797973fso1953401a91.3 for <71083@debbugs.gnu.org>; Sat, 25 May 2024 17:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716683752; x=1717288552; darn=debbugs.gnu.org; h=content-transfer-encoding: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=esEBI2ea10KAdICRg5hA77a32DuqJ30p2aY3lzmPCY0=; b=J6kjnJ0tSoZyrmtmCDVbqx57jjudpXZ/KcdNtEuA7KtfvyzxxaGRziyrYPd0l+N2rK nlHR9tZd03xiJ3S+mtZE0GIt6r6CYIIsxoAfVYu5UEAMjI3JJpvbNbTPVnTQKjGDrHD+ 9pb/TqsoKSfxMDFcKyupDEEbPlfj7HTP2S8LSTbGoHug6w/ocwTISD/4lzo2ovELwdEu ZGkVnZr8e8oDXty3UqoO52fmrNO8P43RNTrH87nwN1/e4wOdMHp4IByhp5YLACk4ZHw5 xvM8b/8vO9fgOUgSDHMBgK6XSfEptfitH6VyO0cyxh5B9ymj8e6MtQwY8WivfEXkbzjC wG5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716683752; x=1717288552; h=content-transfer-encoding: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=esEBI2ea10KAdICRg5hA77a32DuqJ30p2aY3lzmPCY0=; b=NpJpi0Dppun7ZS9kgnvh/glNJ0aq3JvuKizgcwU5w/sDciegXltk1i7eCltOz0rGW4 m4RasAXizZ7gG8ykFENFA7HeYNDcIdz35vK9LzDjnloQZgUulcd3vPlMafGAPdwm1fI8 sRT4XZdqdJz8dYfMhg8BVUdXbLnhiKtGk5eoS4u+kRqzT+KKWLVZqvLKGCen9xvzsuFV dAwTr/Z4SZI4XPfSa/wrom6j/koKTKX+eet4lUqPCoUtasqRAKPQp2cjE4LBsyb+jZLX wqN0soT6cZzqw4kyRhXmuKlI7UA1jHdZ7CisFyLGGZ9QyQdgwjV39YWExwKDu57jyuux APiw== X-Forwarded-Encrypted: i=1; AJvYcCXpPTSDODirTeX/M05tBmQl6PP/Kq50yKFdI+GNAAC4LYZDaHr1/w5hrR5mIED/2D02PTqgJkKbcyk162SuM5eTpNQtZIE= X-Gm-Message-State: AOJu0Yz4kkT1HciSWxhEzHmzkQgjhtMA7Qxrxv8iye/t2s1Zl0c0cl64 hJrYOW096N29VsVsWNyNnJ7KBbrzt0S677lK4JKZEKj+ztBvo5s+ X-Google-Smtp-Source: AGHT+IGG1FtjcG2yBo4pzv4oFOYh9qAS8WFbT9bicWuFl/WvMFFJPEhxkCemjrw1P0/D0igKH6OSwA== X-Received: by 2002:a17:903:120c:b0:1f2:f63b:4795 with SMTP id d9443c01a7336-1f4486c65e6mr80142075ad.14.1716683752239; Sat, 25 May 2024 17:35:52 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2bdd9f4bdcbsm5252388a91.36.2024.05.25.17.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 17:35:51 -0700 (PDT) In-Reply-To: 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:285916 Archived-At: Lin Sun wrote: > On Sat, May 25, 2024 at 8:49=E2=80=AFAM kobarity wro= te: > > 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 condit= ion > > > > branches. > > > > > > > > So this patch will make sending block without header to be the defa= ult > > > > behavior, and a prefix "C-u" will make the function to send block w= ith > > > > header. > > > > > > > > Please help review this minor change. Thanks > > > > > > > > > > > > From 7eefbf3e4de925c211e483a809d0f8d94e8d17f0 Mon Sep 17 00:00:00 2= 001 > > > > From: Lin Sun > > > > Date: Mon, 20 May 2024 06:55:31 +0000 > > > > Subject: [PATCH] ; Enhance the "python-shell-send-block" for conven= ience > > > > > > > > * lisp/progmodes/python.el (python-shell-send-block): > > > > The "python-shell-send-block" will send block without header defa= ultly. > > > > * 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/progmo= des/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. > Hi kobarity, >=20 > Thank you for the comment, you're right. I had fixed the flymake > diagnostics and the commit message. >=20 > Please help review again. Thanks. Thanks, it looks good to me.