[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python mode, suggestion for command
From: |
Eshel Yaron |
Subject: |
Re: Python mode, suggestion for command |
Date: |
Sun, 30 Jul 2023 09:29:09 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi there,
>> Dear python-mode maintainers,
I'm not a `python-mode` maintainer, just a user, but here are my two cents:
>> 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.
Regardless of the command, I'd consider picking another binding
(perhaps along side this one) since some users (including yours truly)
are used to press `C-m` instead of the `<return>` key.
>> (defun python-shell-send-paragraph (&optional send-main msg)
>> "Send all lines of code between two white lines to inferior
>> Python process. SEND-MAIN defaults to nil and MSG to t.
>> See `python-shell-send-region for more information.
I'd say something like "SEND-MAIN and MSG have the same meaning as in
`python-shell-send-paragraph', which see." to make this more obvious.
>> Interactively, SEND-MAIN is the prefix argument"
>> (interactive "Pi")
This is probably supposed to be `(interactive "P\ni")`?
>> (python-shell-send-region
>> (or (save-excursion (re-search-backward "^[:blank:]*$" nil t))
>> (point-min))
>> (or (save-excursion (re-search-forward "^[:blank:]*$" nil t))
>> (point-max))
This method of finding the boundaries of the paragraph at point seems
slightly ad-hoc and fragile, I wonder what happens if there's a blank
line in the middle of a multi-line string?
>> send-main (not msg) t))
Just a couple of thoughts :)
Best,
--
Eshel
- Python mode, suggestion for command, chiel, 2023/07/30
- Re: Python mode, suggestion for command, Eli Zaretskii, 2023/07/30
- Re: Python mode, suggestion for command,
Eshel Yaron <=
- Re: Python mode, suggestion for command, chiel, 2023/07/30
- Re: Python mode, suggestion for command, chiel, 2023/07/30
- Re: Python mode, suggestion for command, kobarity, 2023/07/31
- Re: Python mode, suggestion for command, Matthias Meulien, 2023/07/31