bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60666: 30.0.50; [PATCH] Use field properties in Eshell buffers


From: Jim Porter
Subject: bug#60666: 30.0.50; [PATCH] Use field properties in Eshell buffers
Date: Tue, 10 Jan 2023 11:28:17 -0800

On 1/10/2023 4:13 AM, Eli Zaretskii wrote:
I don't think I understand why keeping eshell-bol and telling people
to bind <HOME> to that function if they want wouldn't be a much more
reasonable solution.  I'm probably missing something.

Do you mean that users who want <home> to go to the very beginning of the line would bind it to 'eshell-bol'? If so, that wouldn't help. 'eshell-bol' moves the point to the beginning of the user's input, not the actual beginning of the line.

If you mean the other way, and that users who want <home> to go to the beginning of the input should just bind it to 'eshell-bol', that would help, but then we wouldn't get the benefits of using 'field' properties in Eshell. One of the nice things about using 'field' properties is that 'eshell-prompt-regexp' is no longer necessary[1]. That regexp is fairly brittle. Also, users who customize their prompt need to make sure they update it correctly.

Here's an example of the brittleness. Starting from "emacs -Q -f eshell":

  ~ $ mkdir "folder #1"
  ~ $ cd "folder #1"
  ~/folder #1 $ |
                ^-- Point is here

Now press C-a. Normally, that should take you to the beginning of the input, but it takes you to the beginning of the whole line because the prompt regexp isn't robust enough. Even worse, because Eshell can't tell where the user's input starts, completion doesn't work on that line. (We could probably fix this particular case by just tweaking 'eshell-prompt-regexp', but I don't think it could ever work in *all* cases, whereas it shouldn't be hard to get perfection with 'field' properties.)

Avoiding the need for 'eshell-prompt-regexp' also makes it simpler to customize the Eshell prompt. Currently, it's just another thing to set, and it's easy to get it wrong (it took me several tries to get it right in my own configuration). The next patch I have planned for Eshell will make it easier to customize the prompt[2], so getting rid of 'eshell-prompt-regexp' would be nice for any users who want to finally try customizing the prompt.

[1] Except for using it to set 'paragraph-start' in Eshell.

[2] I plan to use 'format-mode-line' and provide some mode-line constructs ("prompt constructs"?) for Eshell. Then users will have a small toolbox of constructs they could use for their prompts.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]