all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
@ 2024-03-15 20:07 Dima Kogan
  2024-03-16  7:16 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Dima Kogan @ 2024-03-15 20:07 UTC (permalink / raw)
  To: 69819

Hi. Here's a recipe:

1. emacs -Q

2. M-x shell

3. Observe that the shell is live. You can run commands, and the
   inferior process responds

4. C-x C-q

   Turns on read-only-mode

5. Observe that we now cannot interact with the shell since it's
   read-only. We can C-x C-q again to make it work again. Before step 6,
   C-x C-q again, to make it read-only

6. C-d

   This normally exits the shell. But if we're read-only, it shouldn't
   do that. I see that it still works, despite being read-only.


I'm observing this with all comint-based modes, not just shell-mode.

Thanks!





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

* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
  2024-03-15 20:07 bug#69819: 30.0.50; comint-mode does not always respect the read-only flag Dima Kogan
@ 2024-03-16  7:16 ` Eli Zaretskii
  2024-03-17 19:51   ` Dima Kogan
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-16  7:16 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 69819

> From: Dima Kogan <dima@secretsauce.net>
> Date: Fri, 15 Mar 2024 13:07:40 -0700
> 
> Hi. Here's a recipe:
> 
> 1. emacs -Q
> 
> 2. M-x shell
> 
> 3. Observe that the shell is live. You can run commands, and the
>    inferior process responds
> 
> 4. C-x C-q
> 
>    Turns on read-only-mode
> 
> 5. Observe that we now cannot interact with the shell since it's
>    read-only. We can C-x C-q again to make it work again. Before step 6,
>    C-x C-q again, to make it read-only
> 
> 6. C-d
> 
>    This normally exits the shell. But if we're read-only, it shouldn't
>    do that. I see that it still works, despite being read-only.

Why do you think C-d shouldn't work when the buffer is read-only?

> I'm observing this with all comint-based modes, not just shell-mode.

It's a feature, AFAICT.  But I'm interested in hearing why you thought
it was a bug.





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

* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
  2024-03-16  7:16 ` Eli Zaretskii
@ 2024-03-17 19:51   ` Dima Kogan
  2024-03-17 20:22     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Dima Kogan @ 2024-03-17 19:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69819

> Why do you think C-d shouldn't work when the buffer is read-only?
>
>> I'm observing this with all comint-based modes, not just shell-mode.
>
> It's a feature, AFAICT.  But I'm interested in hearing why you thought
> it was a bug.


Is there no expectation that a "read-only" mode would block any changes
to a buffer? Killing the inferior process breaks that expectation, hence
this report.

That said, I've been a daily user of shell-mode for something like 25
years, and encountered it for the first time just recently, so fixing
this surely isn't very high priority. But still.

Thanks!





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

* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
  2024-03-17 19:51   ` Dima Kogan
@ 2024-03-17 20:22     ` Eli Zaretskii
  2024-03-18  4:57       ` Dima Kogan
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-17 20:22 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 69819

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 69819@debbugs.gnu.org
> Date: Sun, 17 Mar 2024 12:51:20 -0700
> 
> > Why do you think C-d shouldn't work when the buffer is read-only?
> >
> >> I'm observing this with all comint-based modes, not just shell-mode.
> >
> > It's a feature, AFAICT.  But I'm interested in hearing why you thought
> > it was a bug.
> 
> 
> Is there no expectation that a "read-only" mode would block any changes
> to a buffer? Killing the inferior process breaks that expectation, hence
> this report.

What expectation, exactly?  The buffer is not changed; the process is
terminated, but that's not the same as changing the process's buffer!





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

* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
  2024-03-17 20:22     ` Eli Zaretskii
@ 2024-03-18  4:57       ` Dima Kogan
  2024-03-18 13:16         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Dima Kogan @ 2024-03-18  4:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69819

> What expectation, exactly? The buffer is not changed; the process is
> terminated, but that's not the same as changing the process's buffer!

The buffer IS changed, actually: when the inferior process dies, it
prints a message into the buffer:

  Process shell<1> finished

But that's a red herring I think: if the inferior process died, but the
printing was blocked by the read-only mode, I would still consider that
to be a bug.

My use case is this. I use shell-mode buffers extensively. Periodically
I want to examine the output of some command in a *shell* buffer:
compare it against other data, look at it, cut/paste it, whatever. While
I'm doing that I don't want to accidentally change anything, so I C-x
C-q. Then accidental keystrokes don't end up changing anything. UNLESS
that accidental keystroke is C-d (and probably a few others I haven't
hit by mistake yet). This use case and expectation seems reasonable to
me.

Thanks.





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

* bug#69819: 30.0.50; comint-mode does not always respect the read-only flag
  2024-03-18  4:57       ` Dima Kogan
@ 2024-03-18 13:16         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-18 13:16 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 69819

> From: Dima Kogan <dima@secretsauce.net>
> Cc: 69819@debbugs.gnu.org
> Date: Sun, 17 Mar 2024 21:57:26 -0700
> 
> > What expectation, exactly? The buffer is not changed; the process is
> > terminated, but that's not the same as changing the process's buffer!
> 
> The buffer IS changed, actually: when the inferior process dies, it
> prints a message into the buffer:
> 
>   Process shell<1> finished

Not relevant: this comes from the process sentinel, which is invoked
when the process exits.  By that time, the buffer is no long a shell
buffer, and the process finished notification is shown to announce the
end of the session.

> My use case is this. I use shell-mode buffers extensively. Periodically
> I want to examine the output of some command in a *shell* buffer:
> compare it against other data, look at it, cut/paste it, whatever. While
> I'm doing that I don't want to accidentally change anything, so I C-x
> C-q. Then accidental keystrokes don't end up changing anything. UNLESS
> that accidental keystroke is C-d (and probably a few others I haven't
> hit by mistake yet). This use case and expectation seems reasonable to
> me.

I don't agree that it is reasonable.  C-d is a key that is bound to a
certain function, not unlike C-f or C-v.  You wouldn't expect C-f or
C-v not do their job when a buffer is read-only, would you?  Then why
expect that from C-d?

As for your use case: I understand now where you are coming from, but
I think that what you want is a missing feature; that it just happens
to work with 99% of your keystrokes is sheer luck.  What you want is a
feature whereby input to the shell is blocked until explicitly
unblocked by the user, in which case C-d would be blocked as well.  I
don't think we have such a feature, so I propose to add it.





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

end of thread, other threads:[~2024-03-18 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15 20:07 bug#69819: 30.0.50; comint-mode does not always respect the read-only flag Dima Kogan
2024-03-16  7:16 ` Eli Zaretskii
2024-03-17 19:51   ` Dima Kogan
2024-03-17 20:22     ` Eli Zaretskii
2024-03-18  4:57       ` Dima Kogan
2024-03-18 13:16         ` Eli Zaretskii

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.