GNU bug report logs - #38426
27.0.50; [PATCH] * python.el: new function python-shell-send-statement

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: <lin.sun@HIDDEN>; Keywords: patch; dated Fri, 29 Nov 2019 15:06:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 38426 <at> debbugs.gnu.org:


Received: (at 38426) by debbugs.gnu.org; 8 Dec 2019 05:59:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 08 00:59:21 2019
Received: from localhost ([127.0.0.1]:50360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1idpbF-0000A2-Ai
	for submit <at> debbugs.gnu.org; Sun, 08 Dec 2019 00:59:21 -0500
Received: from eggs.gnu.org ([209.51.188.92]:52901)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>)
 id 1idpbD-00009l-To; Sun, 08 Dec 2019 00:59:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60141)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1idWeU-0003yF-Ca; Sat, 07 Dec 2019 04:45:26 -0500
Received: from [176.228.60.248] (port=4325 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1idWeT-0005ll-17; Sat, 07 Dec 2019 04:45:25 -0500
Date: Sat, 07 Dec 2019 11:45:13 +0200
Message-Id: <838snofp06.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: <lin.sun@HIDDEN>
In-reply-to: <046101d5a690$b8e69bc0$2ab3d340$@zoom.us> (lin.sun@HIDDEN)
Subject: Re: bug#38426: 27.0.50;
 [PATCH] * python.el: new function python-shell-send-statement
References: <046101d5a690$b8e69bc0$2ab3d340$@zoom.us>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 38426
Cc: larsi@HIDDEN, 38426 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

severity 38426 wishlist
thanks

> From: <lin.sun@HIDDEN>
> Date: Fri, 29 Nov 2019 16:40:55 +0800
> 
> >From 61db0e91094297ddca302eaf691cf5b4ff82ebf6 Mon Sep 17 00:00:00 2001
> From: "lin.sun" <lin.sun@HIDDEN>
> Date: Fri, 29 Nov 2019 03:10:12 -0500
> Subject: [PATCH] * python.el: new function python-shell-send-statement
> 
> Add new function `python-shell-send-statement' and bind to key "C-c
> C-e" for sending statement under cursor to inferior Python process.
> ---
>  lisp/progmodes/python.el | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Thanks, but for us to accept a contribution this large we need a
copyright assignment from you.  Would you like to start the legal
paperwork at this time?  If so, I will send you the form to fill and
email.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38426; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Nov 2019 15:05:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 29 10:05:19 2019
Received: from localhost ([127.0.0.1]:33416 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iahpf-0002rc-4k
	for submit <at> debbugs.gnu.org; Fri, 29 Nov 2019 10:05:19 -0500
Received: from lists.gnu.org ([209.51.188.17]:36136)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lin.sun@HIDDEN>) id 1iabpx-0001uU-8v
 for submit <at> debbugs.gnu.org; Fri, 29 Nov 2019 03:41:13 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:55022)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <lin.sun@HIDDEN>) id 1iabpt-0000gt-Rd
 for bug-gnu-emacs@HIDDEN; Fri, 29 Nov 2019 03:41:11 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lin.sun@HIDDEN>) id 1iabpo-0005oL-7O
 for bug-gnu-emacs@HIDDEN; Fri, 29 Nov 2019 03:41:07 -0500
Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:45560)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <lin.sun@HIDDEN>) id 1iabpn-0005Zg-VF
 for bug-gnu-emacs@HIDDEN; Fri, 29 Nov 2019 03:41:04 -0500
Received: by mail-pf1-x429.google.com with SMTP id z4so14299055pfn.12
 for <bug-gnu-emacs@HIDDEN>; Fri, 29 Nov 2019 00:41:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zoom.us; s=google;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding:thread-index:content-language;
 bh=sdzleQKj+Y5czZ6udZBLhBik1ohTciwWyTs0oxdC3eY=;
 b=XsXK0wdRKAz9jDFlPMa4YjHQD54t+2X3n7O7qxa5a1ZJV1OiHRfZgNvBipkrk/yNaS
 iEEW+sWvKOKS+z89cWnihcAhts0SCp2f+1HrMcjC3ofg7W7BwzoNwsuLl9uZd0rQBpKT
 pTeWHSWWN6Buuam8oNdlvJCiqeaxIdTc+qqxk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding:thread-index:content-language;
 bh=sdzleQKj+Y5czZ6udZBLhBik1ohTciwWyTs0oxdC3eY=;
 b=d/V7tDwz5uhs3UQ80fH8YJStjshBzbHeMim408Xf2uZJ0S1VmRopOyNBBtMe3a4ok1
 KXkluwn9SRjYGCA6Vf5PO+hbvhJQTjOtjiFVuEc7W0y+mNh5eIzi1kXDK2GxvPPNt37C
 bZJAYOBKfNoDUX3EqFkAIC/TIAsY7RiCFps7ux3GNpfY9QtXNoLCObw4jnVHlkfXSf4w
 6sf7QmwaKevLRMeGRBySRCbge/kEGyslBs9hpnVqTblqPqWMvVyvudyZkvCT3lefJvQi
 FOCttmkO/T0eJKIj59ahnZLROamdlUl/q8RZo/n7k8yj/QZYA7P2j/xx9Y8fO6M0hOZM
 s9Eg==
X-Gm-Message-State: APjAAAX5D7rCmfa/Ry3J0ntAjQRWLj9ar7JHuuSndm0q/kVw10d4ESXa
 DAniOQe2aHXG5vnuoN5kdVE7bFGAlvlK6nFg1Kf/YS0CPM9PX9NsR85RdFpVXf6gvkC96bIvK1+
 DEPzdGWmzAxgLDQ8fwy7XDHNCX71KMQ0lbdO+BAC3vg1kQP4Usjz0hSGRoxkm
X-Google-Smtp-Source: APXvYqzxJeiYnr3MUG1P0kyUmK77Xd2502HAnw7V3VzJ55KIgURXIbv1yOr+cuHjk57xvEFcgy7Icg==
X-Received: by 2002:a63:a0b:: with SMTP id 11mr15778295pgk.114.1575016859449; 
 Fri, 29 Nov 2019 00:40:59 -0800 (PST)
Received: from DESKTOP71C1N5K ([38.99.100.2])
 by smtp.gmail.com with ESMTPSA id j7sm13439916pjz.12.2019.11.29.00.40.57
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 29 Nov 2019 00:40:58 -0800 (PST)
From: <lin.sun@HIDDEN>
To: <bug-gnu-emacs@HIDDEN>,
	"'Lars Ingebrigtsen'" <larsi@HIDDEN>
Subject: 27.0.50; [PATCH] * python.el: new function python-shell-send-statement
Date: Fri, 29 Nov 2019 16:40:55 +0800
Message-ID: <046101d5a690$b8e69bc0$2ab3d340$@zoom.us>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AdWmkLGThNKe9XeAQmKaylmo4iN3Ow==
Content-Language: en-us
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::429
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 29 Nov 2019 10:05:18 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

From 61db0e91094297ddca302eaf691cf5b4ff82ebf6 Mon Sep 17 00:00:00 2001
From: "lin.sun" <lin.sun@HIDDEN>
Date: Fri, 29 Nov 2019 03:10:12 -0500
Subject: [PATCH] * python.el: new function python-shell-send-statement

Add new function `python-shell-send-statement' and bind to key "C-c
C-e" for sending statement under cursor to inferior Python process.
---
 lisp/progmodes/python.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 8e7d9f2..24216af 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -318,6 +318,7 @@ python-mode-map
     ;; Shell interaction
     (define-key map "\C-c\C-p" 'run-python)
     (define-key map "\C-c\C-s" 'python-shell-send-string)
+    (define-key map "\C-c\C-e" 'python-shell-send-statement)
     (define-key map "\C-c\C-r" 'python-shell-send-region)
     (define-key map "\C-\M-x" 'python-shell-send-defun)
     (define-key map "\C-c\C-c" 'python-shell-send-buffer)
@@ -357,6 +358,8 @@ python-mode-map
          :help "Eval string in inferior Python session"]
         ["Eval buffer" python-shell-send-buffer
          :help "Eval buffer in inferior Python session"]
+        ["Eval statement" python-shell-send-statement
+         :help "Eval statement in inferior Python session"]
         ["Eval region" python-shell-send-region
          :help "Eval region in inferior Python session"]
         ["Eval defun" python-shell-send-defun
@@ -3123,6 +3126,23 @@ python-shell-send-region
     (message "Sent: %s..." (match-string 1 original-string))
     (python-shell-send-string string process)))
 
+(defun python-shell-send-statement (&optional send-main msg)
+  "Send the statement delimited by `python-nav-beginning-of-statement' and
+`python-nav-end-of-statement' to inferior Python process. When optional
+argument SEND-MAIN is non-nil, allow execution of code inside blocks
delimited
+by \"if __name__== \\='__main__\\=':\". When called interactively SEND-MAIN
+defaults to nil, unless it's called with prefix argument. When optional
+argument MSG is non-nil, forces display of a user-friendly message if
there's
+no process running; default to t when called interactively. If there is
region
+be activated, it present as `python-shell-send-region'."
+  (interactive (list current-prefix-arg t))
+  (if (region-active-p)
+      (python-shell-send-region (region-beginning) (region-end) send-main
msg)
+    (python-shell-send-region
+     (save-excursion (python-nav-beginning-of-statement))
+     (save-excursion (python-nav-end-of-statement))
+     send-main msg)))
+
 (defun python-shell-send-buffer (&optional send-main msg)
   "Send the entire buffer to inferior Python process.
 When optional argument SEND-MAIN is non-nil, allow execution of
-- 
2.2.0






Acknowledgement sent to <lin.sun@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#38426; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 8 Dec 2019 06:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.