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.devel Subject: Re: Python mode, suggestion for command Date: Tue, 01 Aug 2023 00:52:54 +0900 Message-ID: References: <83tttmkm15.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="36679"; 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 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: Eshel Yaron , Eli Zaretskii , Augusto Stoffel , emacs-devel@gnu.org To: chiel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 31 18:14:50 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qQVXl-0009JV-4B for ged-emacs-devel@m.gmane-mx.org; Mon, 31 Jul 2023 18:14:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQVX5-00008A-V7; Mon, 31 Jul 2023 12:14:12 -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 1qQVCu-0003l6-Uw for emacs-devel@gnu.org; Mon, 31 Jul 2023 11:53:21 -0400 Original-Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQVCt-0001gA-Fd; Mon, 31 Jul 2023 11:53:16 -0400 Original-Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686bea20652so4806503b3a.1; Mon, 31 Jul 2023 08:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690818792; x=1691423592; 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=PywTXabXW/uLsG+fbH0VNcZI2sPRFuGA0G2rrHCrBI8=; b=ALF/5Ig68j2fk3ZVMDOvBduRv9YCuUG5RlcHqA0LjAWT8pHb56d9Lv06XNpS0DTsR5 AXbBJ0tIaWOMK6txRiWJ8bp/97HWNQ7HmfHS/r+SMf8UJIjHy5jrsl8RW+u1br4lufhc cH6eObO+c+ZaJCJHidrxs0A+RXwDC4wQyKEr1vwVRJwbBo8tC1mZSPLioYZyv+LsJOKS acF3rAhGqWA+vSD3NpIIUdeBRoeIVSbzRW62cJnGlqHeGjQafoCDQLiGWF3xTR/Pw72a EfnGDH/EjvmawhEAWhjrghREzqZXlMctBdOIKakeGneRqXoeLkyn6nPM6q+YIBceXVg9 ziFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690818792; x=1691423592; 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=PywTXabXW/uLsG+fbH0VNcZI2sPRFuGA0G2rrHCrBI8=; b=fH37TnYVdSxdrMdbvpjb3CD1OSgmH1YcP58/UCV899kfd8aVIcD84RPrQ9yCRiadd1 RWymCRr8e4VdbJ+zKpbz5mYPys2deeLX5yNl+AcWR5iRzT4zl5QzKHE6tMmqkC0XaWYU GSc1qQ1goFP5bi9orvUC4iY39cL2gl8guZxUuAC8NMSgZokEFCri3HXX6Nkz+2YeKlUa +RWdZWfCXuXXd0q1Yg9kD3/ttqlOftUo3Mfo5QIJ11M8JTLcfZ45yEp6n5TZBaT4rP9I Rj0nVYiNp7PXj5w7T5HUcB9DGo9F+82pAlfsG2bMjo/A2RHnKGHYT71bIVPAWhhhRNkG QC+w== X-Gm-Message-State: ABy/qLaztDFKGIdYie5bOR0sj02KdUeqX1Qo+/ULhLGML6ucdxJRq3SO /cIv8prRs+lesjbY6+x9+3jbuHvVCw0= X-Google-Smtp-Source: APBJJlGiaHmsyrceiuFsYmAdC0+roUOhPTvKqA+fxDtPOtFA24i7nIsWolSrbZhmyGjrlv3oeOvjWg== X-Received: by 2002:a05:6a00:180c:b0:676:399f:346b with SMTP id y12-20020a056a00180c00b00676399f346bmr14409956pfa.1.1690818792241; Mon, 31 Jul 2023 08:53:12 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id t7-20020aa79387000000b00687087d3647sm6521656pfe.142.2023.07.31.08.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 08:53:11 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=kobarity@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 31 Jul 2023 12:13:50 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308224 Archived-At: chiel wrote: > Update: I've been using the following this afternoon and haven't run into any issues so far. However, it looks a bit > messy. > > (defun python-shell-send-paragraph (&optional send-main msg) > "Send blocks between two white lines to inferior Python process. > See `python-shell-send-region' for SEND-MAIN and MSG." > (interactive "P\ni") > (let ((start > (save-excursion > (if (re-search-backward "^[:blank:]*$" nil t) > (let ((pos (point))) > (python-nav-end-of-block) > (if (< (point) pos) pos > (progn (python-nav-beginning-of-block) (point)))) > (point-min)))) > (end > (save-excursion > (if (re-search-forward "^[:blank:]*$" nil t) > (progn (python-nav-end-of-block) (point)) > (point-max))))) > (python-shell-send-region start end send-main (not msg) nil))) > >> I'd like to suggest adding the following command to python.el, >> and binding it to C- by default. I'd love to hear your thoughts. Hi, it would be better to clarify what a paragraph in Python-mode is and explain why it would be useful to be able to send it to Python shell. For example, is the line "b = 2" a stand-alone paragraph? def func(): a = 1 b = 2