unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Don't override 'comint-prompt-read-only' by default
@ 2024-09-13 17:35 Philip Kaludercic
  2024-09-14 23:13 ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Kaludercic @ 2024-09-13 17:35 UTC (permalink / raw)
  To: Emacs-devel@gnu.org

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


I am proposing this change here, because I am aware it might be
controversial.  My motivation is to have more consistent inferior modes,
and not have to be surprised that (as in my case right now,
inferior-python-mode doesn't allow be to kill a prompt).  I haven't
written a NEWS entry yet, but it should probably mention that anyone
interested in restoring the old behaviour should just set
'comint-prompt-read-only' directly.

WDYT?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Don't override 'comint-prompt-read-only' by default --]
[-- Type: text/x-patch, Size: 3600 bytes --]

From c6240fb0f0d9932fb0986ee2426162b90b99b633 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Fri, 13 Sep 2024 19:32:55 +0200
Subject: [PATCH] Don't override 'comint-prompt-read-only' by default

* lisp/cmuscheme.el (inferior-scheme-mode): Remove 'setq-local'.
* lisp/ielm.el (ielm-prompt-read-only): Inherit default from
'comint-prompt-read-only'.
* lisp/progmodes/lua-ts-mode.el (lua-ts-inferior-lua): Remove
'setq-local'.
* lisp/progmodes/php-ts-mode.el (inferior-php-ts-mode): Remove
'setq-local'.
* lisp/progmodes/python.el (inferior-python-mode): Remove
'setq-local'.
---
 lisp/cmuscheme.el             | 1 -
 lisp/ielm.el                  | 2 +-
 lisp/progmodes/lua-ts-mode.el | 1 -
 lisp/progmodes/php-ts-mode.el | 1 -
 lisp/progmodes/python.el      | 1 -
 5 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index d4316fb1175..912fe6b8eca 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -195,7 +195,6 @@ inferior-scheme-mode
   (scheme-mode-variables)
   (setq mode-line-process '(":%s"))
   (setq comint-input-filter (function scheme-input-filter))
-  (setq-local comint-prompt-read-only t)
   (setq comint-get-old-input (function scheme-get-old-input)))
 
 (defcustom inferior-scheme-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'"
diff --git a/lisp/ielm.el b/lisp/ielm.el
index e583e0fe32c..1b8702abc1f 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -46,7 +46,7 @@ ielm-noisy
   "If non-nil, IELM will beep on error."
   :type 'boolean)
 
-(defcustom ielm-prompt-read-only t
+(defcustom ielm-prompt-read-only comint-prompt-read-only
   "If non-nil, the IELM prompt is read only.
 The read only region includes the newline before the prompt.
 Setting this variable does not affect existing IELM runs.
diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 06daadbc1fd..2d039424a2f 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -645,7 +645,6 @@ lua-ts-inferior-lua
     (with-current-buffer lua-ts-inferior-buffer
       (setq-local comint-input-ignoredups t
                   comint-input-ring-file-name lua-ts-inferior-history
-                  comint-prompt-read-only t
                   comint-prompt-regexp (rx-to-string `(: bol
                                                          ,lua-ts-inferior-prompt
                                                          (1+ space))))
diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el
index 3f89de14075..e3d14bd563c 100644
--- a/lisp/progmodes/php-ts-mode.el
+++ b/lisp/progmodes/php-ts-mode.el
@@ -1563,7 +1563,6 @@ inferior-php-ts-mode
   (setq-local scroll-conservatively 1
               comint-input-ring-file-name php-ts-mode-inferior-history
               comint-input-ignoredups t
-              comint-prompt-read-only t
               comint-use-prompt-regexp t
               comint-prompt-regexp (concat "^" php-ts-mode--inferior-prompt " "))
   (comint-read-input-ring t))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 669638544ce..17563d29c63 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3672,7 +3672,6 @@ inferior-python-mode
   (setq-local python-shell--prompt-calculated-output-regexp nil)
   (python-shell-prompt-set-calculated-regexps)
   (setq comint-prompt-regexp python-shell--prompt-calculated-input-regexp)
-  (setq-local comint-prompt-read-only t)
   (setq mode-line-process '(":%s"))
   (setq-local comint-output-filter-functions
               '(ansi-color-process-output
-- 
2.45.2


[-- Attachment #3: Type: text/plain, Size: 34 bytes --]


-- 
	Philip Kaludercic on siskin

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

* Re: [PATCH] Don't override 'comint-prompt-read-only' by default
  2024-09-13 17:35 [PATCH] Don't override 'comint-prompt-read-only' by default Philip Kaludercic
@ 2024-09-14 23:13 ` Stefan Kangas
  2024-09-15  0:31   ` Dmitry Gutov
  2024-09-15 15:48   ` Philip Kaludercic
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Kangas @ 2024-09-14 23:13 UTC (permalink / raw)
  To: Philip Kaludercic, Emacs-devel

Philip Kaludercic <philipk@posteo.net> writes:

> I am proposing this change here, because I am aware it might be
> controversial.  My motivation is to have more consistent inferior modes,
> and not have to be surprised that (as in my case right now,
> inferior-python-mode doesn't allow be to kill a prompt).  I haven't
> written a NEWS entry yet, but it should probably mention that anyone
> interested in restoring the old behaviour should just set
> 'comint-prompt-read-only' directly.
>
> WDYT?

Making `comint-prompt-read-only` nil in more modes seems like a step
backwards to me though; if anything I'd like to make it t in more
places.  I'm actually not sure why it does not already default to t.
That's certainly the default in any REPL that I can think of, so our
default breaks most user expectations.

See, for example, users asking questions on StackOverflow like "How to
prevent backspace from deleting my shell prompt":
https://emacs.stackexchange.com/questions/21751/how-to-prevent-backspace-from-deleting-my-shell-prompt

It makes sense to have the option to be able delete the prompt, though
my preferred UI for that is closer to something like hitting `C-w` twice
(the second time to confirm) rather than setting a variable.  I just
feel like this is highly situation dependent: most of the time I do not
want backspace to delete the prompt, but maybe occasionally I do.

That said, if we can agree to flip `comint-prompt-read-only` to t,
I think your patch should definitely be installed.

My $.02.



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

* Re: [PATCH] Don't override 'comint-prompt-read-only' by default
  2024-09-14 23:13 ` Stefan Kangas
@ 2024-09-15  0:31   ` Dmitry Gutov
  2024-09-15 15:48   ` Philip Kaludercic
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2024-09-15  0:31 UTC (permalink / raw)
  To: Stefan Kangas, Philip Kaludercic, Emacs-devel

On 15/09/2024 02:13, Stefan Kangas wrote:
> That said, if we can agree to flip `comint-prompt-read-only` to t,
> I think your patch should definitely be installed.

Same.



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

* Re: [PATCH] Don't override 'comint-prompt-read-only' by default
  2024-09-14 23:13 ` Stefan Kangas
  2024-09-15  0:31   ` Dmitry Gutov
@ 2024-09-15 15:48   ` Philip Kaludercic
  1 sibling, 0 replies; 4+ messages in thread
From: Philip Kaludercic @ 2024-09-15 15:48 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Emacs-devel

Stefan Kangas <stefankangas@gmail.com> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> I am proposing this change here, because I am aware it might be
>> controversial.  My motivation is to have more consistent inferior modes,
>> and not have to be surprised that (as in my case right now,
>> inferior-python-mode doesn't allow be to kill a prompt).  I haven't
>> written a NEWS entry yet, but it should probably mention that anyone
>> interested in restoring the old behaviour should just set
>> 'comint-prompt-read-only' directly.
>>
>> WDYT?
>
> Making `comint-prompt-read-only` nil in more modes seems like a step
> backwards to me though; if anything I'd like to make it t in more
> places.  I'm actually not sure why it does not already default to t.
> That's certainly the default in any REPL that I can think of, so our
> default breaks most user expectations.
>
> See, for example, users asking questions on StackOverflow like "How to
> prevent backspace from deleting my shell prompt":
> https://emacs.stackexchange.com/questions/21751/how-to-prevent-backspace-from-deleting-my-shell-prompt
>
> It makes sense to have the option to be able delete the prompt, though
> my preferred UI for that is closer to something like hitting `C-w` twice
> (the second time to confirm) rather than setting a variable.  I just
> feel like this is highly situation dependent: most of the time I do not
> want backspace to delete the prompt, but maybe occasionally I do.
>
> That said, if we can agree to flip `comint-prompt-read-only` to t,
> I think your patch should definitely be installed.
>
> My $.02.

I personally wouldn't be a fan, as I think that there is a value in
realising that comint is just a regular buffer and you can edit any way
you like.  That being said, I do understand the issue that newcomers
have when they are used to deleting a line by waiting on backspace
instead of using a command like `kill-whole-line'.

But regardless, we can split this up into two patches.  All I want it to
ensure consistency; perhaps we can discuss what the default should be on
emacs-devel?

-- 
	Philip Kaludercic on icterid



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

end of thread, other threads:[~2024-09-15 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 17:35 [PATCH] Don't override 'comint-prompt-read-only' by default Philip Kaludercic
2024-09-14 23:13 ` Stefan Kangas
2024-09-15  0:31   ` Dmitry Gutov
2024-09-15 15:48   ` Philip Kaludercic

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).