emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python mode, suggestion for command


From: kobarity
Subject: Re: Python mode, suggestion for command
Date: Tue, 01 Aug 2023 00:52:54 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]