unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: kobarity <kobarity@gmail.com>
To: chiel <machiel.kroon@gmail.com>
Cc: Eshel Yaron <me@eshelyaron.com>, Eli Zaretskii <eliz@gnu.org>,
	Augusto Stoffel <arstoffel@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Python mode, suggestion for command
Date: Tue, 01 Aug 2023 00:52:54 +0900	[thread overview]
Message-ID: <eke7tttkw015.wl-kobarity@gmail.com> (raw)
In-Reply-To: <CAPZr=9FGq_qxU9SDgT3Yxixib1skUJ7agxd3LNkQmPpE1A-Vqw@mail.gmail.com>


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-<return> 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



  reply	other threads:[~2023-07-31 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-29 22:08 Python mode, suggestion for command chiel
2023-07-30  5:26 ` Eli Zaretskii
2023-07-30  6:29   ` Eshel Yaron
2023-07-30  6:35     ` chiel
2023-07-30 12:45       ` chiel
2023-07-31 15:52         ` kobarity [this message]
2023-07-31 17:08           ` Matthias Meulien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eke7tttkw015.wl-kobarity@gmail.com \
    --to=kobarity@gmail.com \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=machiel.kroon@gmail.com \
    --cc=me@eshelyaron.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).