GNU bug report logs -
#78262
30.1; comint-delchar-or-maybe-eof doesn't respect delete-active-region
Previous Next
Reported by: Sebastián Monía <sebastian <at> sebasmonia.com>
Date: Mon, 5 May 2025 14:45:02 UTC
Severity: normal
Merged with 73527
Found in versions 30.1, 30.0.90
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> > This assumes that everyone will want the same command bound to C-d
>> > globally to be invoked by C-d in comint-mode. But is that assumption
>> > necessarily true?
>>
>> It's hard to handle all possible worlds at the same time, so I think
>> we have to presume the answer is "yes". If they want something
>> different, they'll have to rebind it explicitly in `comint-mode-map`.
>
> The issue here is whether to support active region (which C-d does).
> Are we sure users of comint want that in respective modes?
The default global binding of `C-d` does not obey `delete-active-region`.
>> -(defun comint-delchar-or-maybe-eof (arg)
>> - "Delete ARG characters forward or send an EOF to subprocess.
>> +(defun comint-delchar-or-maybe-eof ()
>> + "Do like the global binding or send an EOF to subprocess.
>
> I think we need to leave ARG in place, at least as an optional
> argument, since otherwise this would be a breaking change.
Fair enough,
Stefan
diff --git a/lisp/comint.el b/lisp/comint.el
index 188989ff8a4..56e18ac829b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2789,14 +2789,14 @@ comint-kill-input
(if (> (point) (marker-position pmark))
(kill-region pmark (point)))))
-(defun comint-delchar-or-maybe-eof (arg)
- "Delete ARG characters forward or send an EOF to subprocess.
+(defun comint-delchar-or-maybe-eof (&optional _arg)
+ "Do like the global binding or send an EOF to subprocess.
Sends an EOF only if point is at the end of the buffer and there is no input."
- (interactive "p" comint-mode)
+ (interactive nil comint-mode)
(let ((proc (get-buffer-process (current-buffer))))
(if (and (eobp) proc (= (point) (marker-position (process-mark proc))))
(comint-send-eof)
- (delete-char arg))))
+ (call-interactively (lookup-key global-map (this-command-keys))))))
(defun comint-send-eof ()
"Send an EOF to the current buffer's process."
This bug report was last modified 64 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.