all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#57885: [PATCH] Add a command to restart the Python shell
@ 2022-09-17 17:09 Augusto Stoffel
  2022-09-17 17:15 ` Eli Zaretskii
  2022-09-17 17:32 ` Stefan Kangas
  0 siblings, 2 replies; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-17 17:09 UTC (permalink / raw)
  To: 57885

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

Tags: patch

I find this pretty much essential when running "notebooks" and the like.

I think "C-c C-n" would be a reasonable keybinding, but since I can't
find any precedent, I didn't include a keybinding.

Also, in case the `string-trim' call looks hacky, I should add that the
relationship between the shell buffer and process name is pretty much
hardcoded in python.el, so there doesn't seem to be anything more
reasonable to do that wouldn't require some major refactoring.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-progmodes-python.el-python-shell-restart-New-co.patch --]
[-- Type: text/patch, Size: 1556 bytes --]

From 3ccd5651604bd0e90b6504148e8c770355b2e3e4 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sat, 17 Sep 2022 19:01:57 +0200
Subject: [PATCH] * lisp/progmodes/python.el (python-shell-restart): New
 command.

---
 lisp/progmodes/python.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 9f9439aac6..4965d436a0 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3217,6 +3217,25 @@ run-python
                   show)))
     (get-buffer-process buffer)))
 
+(defun python-shell-restart (&optional show)
+  "Restart the Python shell.
+With a prefix argument, also SHOW the buffer."
+  (interactive "P")
+  (with-current-buffer
+      (or (when (derived-mode-p 'inferior-python-mode)
+            (current-buffer))
+          (seq-some (lambda (dedicated)
+                      (get-buffer (format "*%s*" (python-shell-get-process-name
+                                                  dedicated))))
+                    '(buffer project nil))
+          (user-error "No Python shell"))
+    (when-let ((proc (get-buffer-process (current-buffer))))
+      (kill-process proc)
+      (while (accept-process-output proc)))
+    (python-shell-make-comint (python-shell-calculate-command)
+                              (string-trim (buffer-name) "\\*" "\\*")
+                              show)))
+
 (defun run-python-internal ()
   "Run an inferior Internal Python process.
 Input and output via buffer named after
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:09 bug#57885: [PATCH] Add a command to restart the Python shell Augusto Stoffel
@ 2022-09-17 17:15 ` Eli Zaretskii
  2022-09-17 17:36   ` Augusto Stoffel
  2022-09-17 17:32 ` Stefan Kangas
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2022-09-17 17:15 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885

> From: Augusto Stoffel <arstoffel@gmail.com>
> Date: Sat, 17 Sep 2022 19:09:40 +0200
> 
> +(defun python-shell-restart (&optional show)
> +  "Restart the Python shell.
> +With a prefix argument, also SHOW the buffer."

Our style for the second sentence is

  Optional argument SHOW (interactively, the prefix argument), if
  non-nil, means also display the Python shell buffer.

That is, document the argument both for calls from Lisp and for
interactive invocations.

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:09 bug#57885: [PATCH] Add a command to restart the Python shell Augusto Stoffel
  2022-09-17 17:15 ` Eli Zaretskii
@ 2022-09-17 17:32 ` Stefan Kangas
  2022-09-17 17:39   ` Augusto Stoffel
  1 sibling, 1 reply; 15+ messages in thread
From: Stefan Kangas @ 2022-09-17 17:32 UTC (permalink / raw)
  To: Augusto Stoffel, 57885

Augusto Stoffel <arstoffel@gmail.com> writes:

> I think "C-c C-n" would be a reasonable keybinding, but since I can't
> find any precedent, I didn't include a keybinding.

`C-c C-n' is usually used to go to the next thing, so maybe we could try
to find some better key.

Looks good to me (but I didn't test it), with two minor comments:

> +(defun python-shell-restart (&optional show)
> +  "Restart the Python shell.
> +With a prefix argument, also SHOW the buffer."
> +  (interactive "P")
> +  (with-current-buffer
> +      (or (when (derived-mode-p 'inferior-python-mode)
> +            (current-buffer))

As a minor style point, I'd prefer:

    (and (derived-mode-p 'inferior-python-mode)
         (current-buffer))

to make it clear that we want the value.

> +          (seq-some (lambda (dedicated)
> +                      (get-buffer (format "*%s*" (python-shell-get-process-name
> +                                                  dedicated))))
> +                    '(buffer project nil))
> +          (user-error "No Python shell"))
> +    (when-let ((proc (get-buffer-process (current-buffer))))
> +      (kill-process proc)
> +      (while (accept-process-output proc)))

Should there be an error here if there is no running process?

> +    (python-shell-make-comint (python-shell-calculate-command)
> +                              (string-trim (buffer-name) "\\*" "\\*")
> +                              show)))





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:15 ` Eli Zaretskii
@ 2022-09-17 17:36   ` Augusto Stoffel
  0 siblings, 0 replies; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-17 17:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57885

On Sat, 17 Sep 2022 at 20:15, Eli Zaretskii wrote:

>> From: Augusto Stoffel <arstoffel@gmail.com>
>> Date: Sat, 17 Sep 2022 19:09:40 +0200
>> 
>> +(defun python-shell-restart (&optional show)
>> +  "Restart the Python shell.
>> +With a prefix argument, also SHOW the buffer."
>
> Our style for the second sentence is
>
>   Optional argument SHOW (interactively, the prefix argument), if
>   non-nil, means also display the Python shell buffer.
>
> That is, document the argument both for calls from Lisp and for
> interactive invocations.
>
> Thanks.

Sounds better indeed, will send an update in the other reply.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:32 ` Stefan Kangas
@ 2022-09-17 17:39   ` Augusto Stoffel
  2022-09-17 18:04     ` Stefan Kangas
  2022-09-19  3:32     ` Richard Stallman
  0 siblings, 2 replies; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-17 17:39 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 57885

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]

On Sat, 17 Sep 2022 at 13:32, Stefan Kangas wrote:

> Augusto Stoffel <arstoffel@gmail.com> writes:
>
>> I think "C-c C-n" would be a reasonable keybinding, but since I can't
>> find any precedent, I didn't include a keybinding.
>
> `C-c C-n' is usually used to go to the next thing, so maybe we could try
> to find some better key.

Okay, then let's decide later (or not decide :-)).

> Looks good to me (but I didn't test it), with two minor comments:
>
>> +(defun python-shell-restart (&optional show)
>> +  "Restart the Python shell.
>> +With a prefix argument, also SHOW the buffer."
>> +  (interactive "P")
>> +  (with-current-buffer
>> +      (or (when (derived-mode-p 'inferior-python-mode)
>> +            (current-buffer))
>
> As a minor style point, I'd prefer:
>
>     (and (derived-mode-p 'inferior-python-mode)
>          (current-buffer))
>
> to make it clear that we want the value.


Okay

>> +          (seq-some (lambda (dedicated)
>> +                      (get-buffer (format "*%s*" (python-shell-get-process-name
>> +                                                  dedicated))))
>> +                    '(buffer project nil))
>> +          (user-error "No Python shell"))
>> +    (when-let ((proc (get-buffer-process (current-buffer))))
>> +      (kill-process proc)
>> +      (while (accept-process-output proc)))
>
> Should there be an error here if there is no running process?
>

No, and if fact, if the process is dead, you want to call this command
to start the shell again (it happens to me and it works).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-progmodes-python.el-python-shell-restart-New-co.patch --]
[-- Type: text/x-patch, Size: 1631 bytes --]

From e0b1d4cb08a57e2170efb92b74c2ce60e4ea7113 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sat, 17 Sep 2022 19:01:57 +0200
Subject: [PATCH] * lisp/progmodes/python.el (python-shell-restart): New
 command.

---
 lisp/progmodes/python.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 9f9439aac6..6ef468d2cb 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3217,6 +3217,26 @@ run-python
                   show)))
     (get-buffer-process buffer)))
 
+(defun python-shell-restart (&optional show)
+  "Restart the Python shell.
+Optional argument SHOW (interactively, the prefix argument), if
+non-nil, means also display the Python shell buffer."
+  (interactive "P")
+  (with-current-buffer
+      (or (and (derived-mode-p 'inferior-python-mode)
+               (current-buffer))
+          (seq-some (lambda (dedicated)
+                      (get-buffer (format "*%s*" (python-shell-get-process-name
+                                                  dedicated))))
+                    '(buffer project nil))
+          (user-error "No Python shell"))
+    (when-let ((proc (get-buffer-process (current-buffer))))
+      (kill-process proc)
+      (while (accept-process-output proc)))
+    (python-shell-make-comint (python-shell-calculate-command)
+                              (string-trim (buffer-name) "\\*" "\\*")
+                              show)))
+
 (defun run-python-internal ()
   "Run an inferior Internal Python process.
 Input and output via buffer named after
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:39   ` Augusto Stoffel
@ 2022-09-17 18:04     ` Stefan Kangas
  2022-09-18  6:53       ` Augusto Stoffel
  2022-09-19  3:32     ` Richard Stallman
  1 sibling, 1 reply; 15+ messages in thread
From: Stefan Kangas @ 2022-09-17 18:04 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885

Augusto Stoffel <arstoffel@gmail.com> writes:

> Okay, then let's decide later (or not decide :-)).

:-)

> No, and if fact, if the process is dead, you want to call this command
> to start the shell again (it happens to me and it works).

Makes sense.

> Subject: [PATCH] * lisp/progmodes/python.el (python-shell-restart): New
>  command.

BTW, maybe you want to add a first line with text like

    Add new command python-shell-restart





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 18:04     ` Stefan Kangas
@ 2022-09-18  6:53       ` Augusto Stoffel
  2022-09-18 10:53         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-18  6:53 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 57885

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

On Sat, 17 Sep 2022 at 14:04, Stefan Kangas wrote:

> Augusto Stoffel <arstoffel@gmail.com> writes:
>
>> Okay, then let's decide later (or not decide :-)).
>
> :-)
>
>> No, and if fact, if the process is dead, you want to call this command
>> to start the shell again (it happens to me and it works).
>
> Makes sense.
>
>> Subject: [PATCH] * lisp/progmodes/python.el (python-shell-restart): New
>>  command.
>
> BTW, maybe you want to add a first line with text like
>
>     Add new command python-shell-restart

Find attached a patch with an expanded commit message, and also an
unrelated but trivial refinement for something else.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-new-command-python-shell-restart.patch --]
[-- Type: text/x-patch, Size: 1671 bytes --]

From ce69165e1050601a0ed4a9b45aca998793b468fe Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sat, 17 Sep 2022 19:01:57 +0200
Subject: [PATCH 1/2] Add new command python-shell-restart

* lisp/progmodes/python.el (python-shell-restart): New command.
---
 lisp/progmodes/python.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 9f9439aac6..6ef468d2cb 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3217,6 +3217,26 @@ run-python
                   show)))
     (get-buffer-process buffer)))
 
+(defun python-shell-restart (&optional show)
+  "Restart the Python shell.
+Optional argument SHOW (interactively, the prefix argument), if
+non-nil, means also display the Python shell buffer."
+  (interactive "P")
+  (with-current-buffer
+      (or (and (derived-mode-p 'inferior-python-mode)
+               (current-buffer))
+          (seq-some (lambda (dedicated)
+                      (get-buffer (format "*%s*" (python-shell-get-process-name
+                                                  dedicated))))
+                    '(buffer project nil))
+          (user-error "No Python shell"))
+    (when-let ((proc (get-buffer-process (current-buffer))))
+      (kill-process proc)
+      (while (accept-process-output proc)))
+    (python-shell-make-comint (python-shell-calculate-command)
+                              (string-trim (buffer-name) "\\*" "\\*")
+                              show)))
+
 (defun run-python-internal ()
   "Run an inferior Internal Python process.
 Input and output via buffer named after
-- 
2.37.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Remap-up-list-in-python-mode-map.patch --]
[-- Type: text/x-patch, Size: 1122 bytes --]

From 8002e7a2ec6711b057529db082ed2f3691912004 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sun, 18 Sep 2022 08:47:01 +0200
Subject: [PATCH 2/2] Remap 'up-list' in python-mode-map

The original 'up-list' command doesn't work as expected in
python-mode, and its sibling 'backward-up-list' already has a
remapping.

* lisp/progmodes/python.el (python-mode-map): Remap 'up-list' to
'python-nav-up-list'.
---
 lisp/progmodes/python.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 6ef468d2cb..09f94f4b34 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -300,6 +300,7 @@ python-mode-map
     (define-key map [remap backward-sentence] #'python-nav-backward-block)
     (define-key map [remap forward-sentence] #'python-nav-forward-block)
     (define-key map [remap backward-up-list] #'python-nav-backward-up-list)
+    (define-key map [remap up-list] #'python-nav-up-list)
     (define-key map [remap mark-defun] #'python-mark-defun)
     (define-key map "\C-c\C-j" #'imenu)
     ;; Indent specific
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-18  6:53       ` Augusto Stoffel
@ 2022-09-18 10:53         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-18 10:53 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885, Stefan Kangas

Augusto Stoffel <arstoffel@gmail.com> writes:

> Find attached a patch with an expanded commit message, and also an
> unrelated but trivial refinement for something else.

Thanks; pushed to Emacs 29.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-17 17:39   ` Augusto Stoffel
  2022-09-17 18:04     ` Stefan Kangas
@ 2022-09-19  3:32     ` Richard Stallman
  2022-09-19  7:20       ` Augusto Stoffel
  1 sibling, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2022-09-19  3:32 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

In Shell mode, if you terminate the shell, M-x shell will restart it.
That is easy to remember and does not require adding any commands to Emacs.

Can the same solution work here?

Does it perhaps work already?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-19  3:32     ` Richard Stallman
@ 2022-09-19  7:20       ` Augusto Stoffel
  2022-09-28  2:52         ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-19  7:20 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 57885, stefankangas

On Sun, 18 Sep 2022 at 23:32, Richard Stallman wrote:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> In Shell mode, if you terminate the shell, M-x shell will restart it.
> That is easy to remember and does not require adding any commands to Emacs.
>
> Can the same solution work here?
>
> Does it perhaps work already?

This already works, but I think the new command is useful for a few
different reasons.

The most important is that you can operate the Python shell entirely
from other buffers using `python-shell-send-region' and related commands
(I use the Python shell to see the outputs, but rarely type input
directly into it).  So the procedure you suggest actually involves a
number of steps that become annoying if you need to repeat them often.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-19  7:20       ` Augusto Stoffel
@ 2022-09-28  2:52         ` Richard Stallman
  2022-09-28  6:36           ` Augusto Stoffel
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2022-09-28  2:52 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > The most important is that you can operate the Python shell entirely
  > from other buffers using `python-shell-send-region' and related commands
  > (I use the Python shell to see the outputs, but rarely type input
  > directly into it).

I can see how that command is useful, but why should that shell not
have a buffer to manipulate it by?  You can still have the
commands that don't use the buffer, but you'll also be able
to use the buffer to restart the shell, kill the shell, and
whatever else.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-28  2:52         ` Richard Stallman
@ 2022-09-28  6:36           ` Augusto Stoffel
  2022-09-29  3:00             ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-28  6:36 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 57885, stefankangas

On Tue, 27 Sep 2022 at 22:52, Richard Stallman wrote:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > The most important is that you can operate the Python shell entirely
>   > from other buffers using `python-shell-send-region' and related commands
>   > (I use the Python shell to see the outputs, but rarely type input
>   > directly into it).
>
> I can see how that command is useful, but why should that shell not
> have a buffer to manipulate it by?  You can still have the
> commands that don't use the buffer, but you'll also be able
> to use the buffer to restart the shell, kill the shell, and
> whatever else.

Yes, you can do all of the above.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-28  6:36           ` Augusto Stoffel
@ 2022-09-29  3:00             ` Richard Stallman
  2022-09-29  7:09               ` Augusto Stoffel
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2022-09-29  3:00 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > I can see how that command is useful, but why should that shell not
  > > have a buffer to manipulate it by?  You can still have the
  > > commands that don't use the buffer, but you'll also be able
  > > to use the buffer to restart the shell, kill the shell, and
  > > whatever else.

  > Yes, you can do all of the above.

I find it hard to understand that concretely.  Are you saying that
these shells do in fact have corresponding buffers?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-29  3:00             ` Richard Stallman
@ 2022-09-29  7:09               ` Augusto Stoffel
  2022-10-07 22:47                 ` Richard Stallman
  0 siblings, 1 reply; 15+ messages in thread
From: Augusto Stoffel @ 2022-09-29  7:09 UTC (permalink / raw)
  To: Richard Stallman; +Cc: 57885, stefankangas

On Wed, 28 Sep 2022 at 23:00, Richard Stallman wrote:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > > I can see how that command is useful, but why should that shell not
>   > > have a buffer to manipulate it by?  You can still have the
>   > > commands that don't use the buffer, but you'll also be able
>   > > to use the buffer to restart the shell, kill the shell, and
>   > > whatever else.
>
>   > Yes, you can do all of the above.
>
> I find it hard to understand that concretely.  Are you saying that
> these shells do in fact have corresponding buffers?

Yes, it does.  It's a pretty conventional shell in the mold of M-x
shell, that is, a buffer where you can type some expressions and see the
result.

It also has some extra features, such as python-shell-send-region which
effectively copies a region of the current buffer (presumably Python
code) and pastes it in the shell buffer and hits RET for you.  You can
later switch to the Python shell buffer to see the result of that
computation.

I hope this clarifies things :-).





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#57885: [PATCH] Add a command to restart the Python shell
  2022-09-29  7:09               ` Augusto Stoffel
@ 2022-10-07 22:47                 ` Richard Stallman
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2022-10-07 22:47 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 57885, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > I find it hard to understand that concretely.  Are you saying that
  > > these shells do in fact have corresponding buffers?

  > Yes, it does.  It's a pretty conventional shell in the mold of M-x
  > shell, that is, a buffer where you can type some expressions and see the
  > result.

I think that is a good design.  It lets the user do things to this
shell in the usual way, by specifying or selecting its buffer.

Somehow your first message suggested to me that this shell would
not belong to a buffer, but I'm glad that was just my misunderstanding.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-10-07 22:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-17 17:09 bug#57885: [PATCH] Add a command to restart the Python shell Augusto Stoffel
2022-09-17 17:15 ` Eli Zaretskii
2022-09-17 17:36   ` Augusto Stoffel
2022-09-17 17:32 ` Stefan Kangas
2022-09-17 17:39   ` Augusto Stoffel
2022-09-17 18:04     ` Stefan Kangas
2022-09-18  6:53       ` Augusto Stoffel
2022-09-18 10:53         ` Lars Ingebrigtsen
2022-09-19  3:32     ` Richard Stallman
2022-09-19  7:20       ` Augusto Stoffel
2022-09-28  2:52         ` Richard Stallman
2022-09-28  6:36           ` Augusto Stoffel
2022-09-29  3:00             ` Richard Stallman
2022-09-29  7:09               ` Augusto Stoffel
2022-10-07 22:47                 ` Richard Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.