From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#73527: 30.0.90; Comint rebinds C-d Date: Sun, 29 Sep 2024 19:08:03 +0300 Organization: LINKOV.NET Message-ID: <86cykmla4s.fsf@mail.linkov.net> References: <87y13cf3zu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40522"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 73527@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 29 18:11:45 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1suwWN-000AQ4-W7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Sep 2024 18:11:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suwWF-0000sL-VR; Sun, 29 Sep 2024 12:11:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suwWC-0000ru-4x for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 12:11:32 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suwWB-0005qs-Fu for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 12:11:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=4AB1/7yJb4IaswygMc/fspbapM89A9PQmnarEHgx2uQ=; b=EyPipgtUw16w5OQ3rOta45/v02hKJSCThluBA8HznyxP/+2JD7bmLbXT/AboGGs0yRqcncX19ly/gmiHmwsa6bzvDPUlS1eq6HzL3Vpw1b12fjMpUzfBHy3vjOr153YrTtmov4GWHsHcWJyBZE+06KIYbYjfV4YsLUQl8OFBXdGJq17Juwmd/mJptZQwvLJFNkSqFpQjPZ137EyMiXh3mpVMchW4OQWACIB6JwwIDYUzNATa/LsS7PwNG03NMI6h1OjhNFdiFof7WZ9r9fNn+qzV3p0yHr4yQtGRmI8rgr0U/u724CS0NJ5VnklpfuXHzO2miP8fOqILG2kz8I2vHA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suwWg-0006rl-Jr for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2024 12:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Sep 2024 16:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73527 X-GNU-PR-Package: emacs Original-Received: via spool by 73527-submit@debbugs.gnu.org id=B73527.172762626426062 (code B ref 73527); Sun, 29 Sep 2024 16:12:02 +0000 Original-Received: (at 73527) by debbugs.gnu.org; 29 Sep 2024 16:11:04 +0000 Original-Received: from localhost ([127.0.0.1]:40934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suwVk-0006mG-5y for submit@debbugs.gnu.org; Sun, 29 Sep 2024 12:11:04 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:50709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suwVi-0006lH-EZ for 73527@debbugs.gnu.org; Sun, 29 Sep 2024 12:11:03 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 0402640003; Sun, 29 Sep 2024 16:10:03 +0000 (UTC) In-Reply-To: <87y13cf3zu.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 28 Sep 2024 12:48:37 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292648 Archived-At: > comint-mode rebinds C-d (to `comint-delchar-or-maybe-eof') in a way that > is supposed to fall back to the default C-d behavior unless point is on > a blank input line. > > If the user rebinds C-d in the global map, e.g. to something sensible > such as `delete-forward-char', this preference is overridden. > > Should a menu-item with :filter property be used instead in > comint-mode-map? It would be nice to make such filter customizable. For example, currently I have to use: (define-key shell-mode-map "\C-d" 'my-shell-c-d) (defun my-shell-c-d (&optional arg) (interactive "p") (cond ((and (eobp) (save-excursion (let ((inhibit-field-text-motion t)) (goto-char (line-beginning-position)) (looking-at-p "^iex.*>\s*$")))) (let ((process (get-buffer-process (current-buffer)))) (process-send-string process ":init.stop()\n"))) ((and (eobp) (save-excursion (let ((inhibit-field-text-motion t)) (goto-char (line-beginning-position)) (looking-at-p "^[a-z:]*cljs\\..*=>\s*$")))) (let ((process (get-buffer-process (current-buffer)))) (process-send-string process ":cljs/quit\n"))) (t (comint-delchar-or-maybe-eof arg)))) But with a filter all these cases could be moved to the filter predicate, along with its default value extracted from 'comint-delchar-or-maybe-eof': (if (and (eobp) proc (= (point) (marker-position (process-mark proc)))) (comint-send-eof) (delete-char arg)) Then rebinding `C-d' from `delete-char' to `delete-forward-char' will be handled automatically. Also for the users of `delete-selection-mode' this will remove the need to add more settings: (put 'comint-delchar-or-maybe-eof 'delete-selection 'supersede) (put 'my-shell-c-d 'delete-selection 'supersede) according to this part of delsel.el: ;; delete-backward-char and delete-forward-char already delete the selection by ;; default, but not delete-char. (put 'delete-char 'delete-selection 'supersede)