From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#60666: 30.0.50; [PATCH] Use field properties in Eshell buffers Date: Tue, 10 Jan 2023 12:51:14 -0800 Message-ID: <0535fb1d-9606-7324-2da3-4e86e0eb1610@gmail.com> References: <83cz7nq588.fsf@gnu.org> <537ece85-8808-c7fa-71b0-c355ff3740bb@gmail.com> <83o7r6oadh.fsf@gnu.org> <6a94f805-cb0f-2328-71f8-c64891b18e06@gmail.com> <83o7r6m9os.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28457"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60666@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 10 21:52:15 2023 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 1pFLbT-0007Hu-Em for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Jan 2023 21:52:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFLbI-0006D1-J6; Tue, 10 Jan 2023 15:52:04 -0500 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 1pFLbG-0006CW-Lr for bug-gnu-emacs@gnu.org; Tue, 10 Jan 2023 15:52:02 -0500 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 1pFLbG-00089s-5y for bug-gnu-emacs@gnu.org; Tue, 10 Jan 2023 15:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFLbG-0003Am-2Z for bug-gnu-emacs@gnu.org; Tue, 10 Jan 2023 15:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Jan 2023 20:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60666 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60666-submit@debbugs.gnu.org id=B60666.167338388612152 (code B ref 60666); Tue, 10 Jan 2023 20:52:02 +0000 Original-Received: (at 60666) by debbugs.gnu.org; 10 Jan 2023 20:51:26 +0000 Original-Received: from localhost ([127.0.0.1]:41260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFLaf-00039v-WE for submit@debbugs.gnu.org; Tue, 10 Jan 2023 15:51:26 -0500 Original-Received: from mail-pg1-f171.google.com ([209.85.215.171]:43861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFLad-00039h-0M for 60666@debbugs.gnu.org; Tue, 10 Jan 2023 15:51:24 -0500 Original-Received: by mail-pg1-f171.google.com with SMTP id 36so9083851pgp.10 for <60666@debbugs.gnu.org>; Tue, 10 Jan 2023 12:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=HJPn6rifLElTNUOwtTbIG9EAZDvcqohCO3ASqjVmUJ4=; b=QOp1nZ0uIiQOahs7b6TjnunA07+O5cdRNfANfnoII1K6OxwsO6LAD6Q0n01FqcxoBm 58zJ3lG3sJKDDmbyMPNquqv7mFxbvky6VqZLk2C5wc/T6TlGSGoHoTbqbFQMBDhy02v/ 9uBjqEKST5Fa2jfS1Na8g8jKu8fGXBT71hV0Xw2tEZlfC6h16iUPGKTNEo7ah7KeWHSm Ok+MnvaK3YIrG9YpuzNHuEgzTZ24DLskVykRaql66AsRI5Rury4v6aru52DKHbT1ZI6f AHGyxvWd5f81/eeof4f+QhEk/K0DpVNMYIVAesN5RKz9VZIwDp3Qa5dpRrDAsY/g7ecC 14Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HJPn6rifLElTNUOwtTbIG9EAZDvcqohCO3ASqjVmUJ4=; b=TAnz60Od1zvZqSIBhH+rWX5lsXj4LFhReDQyYDnDBMIOdtjgKVj3/HgQKujT3qdLg6 G/dpEMIdLQ1As+FhYscuszgl8MPPj7F9JUZ5nECXlFLxs7/MWEw1AXETOhoWBxAZuDwZ xvusaTWPxuoue+Mqoic/VNyyI2gsTDiZPeRtIuRktZpD8u1DCPFL5kxGSqmsqdAtJ9Vf gR7dKk06sb8tYYme+YiOyOm2mlQfPEij2m1po9+MF8eeaCEe3elal+CNmxMIdxwNmrin TNpou4Eg1acorJv0rdEfbubYz2vE25Cg6PUbMakGsdIjuinz2vylKiws2ln/wrFL8Ayl LQpg== X-Gm-Message-State: AFqh2kp7RSE18Fefu9JYJWR/KlzgrEPEUOzBBAdsyY9BDZgMy7ARhlrG /HhdMoM0eQsN7+Uo+XwHoobYZJFOIstDTw== X-Google-Smtp-Source: AMrXdXvUjeHr9bCzWxKY0nt6jfro0hfty0aMsOyzJkomWhDRmM4UOQPUn9fIzIesqMp52UPj4EABFA== X-Received: by 2002:aa7:9254:0:b0:572:6e9b:9f9e with SMTP id 20-20020aa79254000000b005726e9b9f9emr71823719pfp.19.1673383876967; Tue, 10 Jan 2023 12:51:16 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id y9-20020aa79429000000b005826e75f659sm8547935pfo.73.2023.01.10.12.51.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Jan 2023 12:51:16 -0800 (PST) Content-Language: en-US In-Reply-To: <83o7r6m9os.fsf@gnu.org> 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:253115 Archived-At: On 1/10/2023 12:11 PM, Eli Zaretskii wrote: > That's not what I see in Emacs 29. C-a moves to the beginning of > input, i.e. it stops at the end of the prompt, whereas HOME goes all > the way to the beginning of screen line, including the prompt. > > "C-h c" says that C-a is bound to eshell-bol, but HOME is bound to > move-beginning-of-line. > > I'm asking why not let users have this distinction after your change, > with some easy customization? It sounds like we agree but we're looking at this from different directions. Since my patch adds the 'field' property, a user can't just use 'move-beginning-of-line' to go to the very beginning of the line (instead, it stops at the end of the prompt, where the field property ends). I agree that an easy customization to restore the old behavior would be nice. The old behavior has been around a long time, so I'm sure some people have come to rely on it. One option would be to add a new function like 'eshell-really-bol' (with a better name, of course), that calls 'move-beginning-of-line' and ignores fields, like the function I suggested in the NEWS entry. This function wouldn't be used anywhere by default, but it makes it easy for users to restore the behavior. This is probably the simplest, most direct way. Another option might be to enhance 'move-beginning-of-line'. Maybe we could add an option so that calling it the first time obeys field boundaries, but if you immediately call it again, it ignores them. Then, a user who wants to go to the real beginning of a line can just press (or C-a) twice. That's not exactly the same as the old behavior, but it would be usable outside of Eshell, and it's pretty close to maintaining muscle memory: you just need to press the same key again. Something like this might be sufficient, if we add a defcustom to toggle this behavior: ---------------------------------------- diff --git a/lisp/simple.el b/lisp/simple.el index 690968ca938..803c5ee07e4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8174,6 +8174,9 @@ move-beginning-of-line (goto-char (previous-char-property-change (point))) (goto-char (line-beginning-position)))) + (let ((inhibit-field-text-motion + (if (eq last-command #'move-beginning-of-line) + t inhibit-field-text-motion))) ;; Now find first visible char in the line. (while (and (< (point) orig) (invisible-p (point))) (goto-char (next-char-property-change (point) orig))) @@ -8189,7 +8192,7 @@ move-beginning-of-line ;; Otherwise, move to START with attention to fields. ;; (It is possible that fields never matter in this case.) (constrain-to-field (point) orig - (/= arg 1) t nil))))) + (/= arg 1) t nil)))))) ;; Many people have said they rarely use this feature, and often type ---------------------------------------- The above is something I've occasionally wished for in other places. As a workaround, I usually press "C-a C-b C-a" (or " "), but being able to press "C-a C-a" (or " ") would be easier, and probably more robust.