all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60666@debbugs.gnu.org
Subject: bug#60666: 30.0.50; [PATCH] Use field properties in Eshell buffers
Date: Tue, 10 Jan 2023 12:51:14 -0800	[thread overview]
Message-ID: <0535fb1d-9606-7324-2da3-4e86e0eb1610@gmail.com> (raw)
In-Reply-To: <83o7r6m9os.fsf@gnu.org>

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 
<home> (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 "<home> <left> <home>"), 
but being able to press "C-a C-a" (or "<home> <home>") would be easier, 
and probably more robust.





  reply	other threads:[~2023-01-10 20:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-08 23:34 bug#60666: 30.0.50; [PATCH] Use field properties in Eshell buffers Jim Porter
2023-01-09 12:09 ` Eli Zaretskii
2023-01-09 17:52   ` Jim Porter
2023-01-10 12:13     ` Eli Zaretskii
2023-01-10 19:28       ` Jim Porter
2023-01-10 20:11         ` Eli Zaretskii
2023-01-10 20:51           ` Jim Porter [this message]
2023-01-11 12:15             ` Eli Zaretskii
2023-01-12 18:10               ` Jim Porter
2023-01-13 13:07                 ` Eli Zaretskii
2023-01-14 19:30                   ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0535fb1d-9606-7324-2da3-4e86e0eb1610@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=60666@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.