GNU bug report logs -
#76853
M-b not navigating to the previous word in the prompt string inside Eshell on emacs 30.1
Previous Next
Reported by: Hrishikesh S <hrish2006 <at> gmail.com>
Date: Sat, 8 Mar 2025 06:54:02 UTC
Severity: normal
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76853 in the body.
You can then email your comments to 76853 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 08 Mar 2025 06:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Hrishikesh S <hrish2006 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 08 Mar 2025 06:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In GNU Emacs 30.1, System Description: macOS 15.2
which I installed by simply running "brew install emacs" on my work machine,
when I'm inside the eshell buffer, typing `M-b` does not take me back by a
word like how it used to be.
Apologies if the bug doesn't have enough information, but I was able to
verify this behavior on a fresh, clean install, without any of my
configuration or installed packages by running
"emacs -Q" and observing the same behavior.
I searched through existing bug reports and this seems like a new issue.
My relevant emacs config:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; eshell
;;
(require 'em-smart)
(setq eshell-history-size 10000)
(setq eshell-prompt-regexp "^[^#$]*[#$] ")
(defun curr-dir-git-branch-string (pwd)
"Returns current git branch as a string, or the empty string if
PWD is not in a git repo (or the git command is not found)."
(interactive)
(when (and (eshell-search-path "git")
(locate-dominating-file pwd ".git"))
(let ((git-output (shell-command-to-string (concat "cd " pwd " && git
branch | grep '\\*' | sed -e 's/^\\* //'"))))
(propertize (concat " ["
(if (> (length git-output) 0)
(substring git-output 0 -1)
"(no branch)")
"]") 'face `(:foreground "green"))
)))
(setq eshell-prompt-function
(lambda ()
(concat
(propertize ((lambda (p-lst)
(if (> (length p-lst) 3)
(concat
(mapconcat (lambda (elm) (if (zerop (length elm)) ""
(substring elm 0 1)))
(butlast p-lst 3)
"/")
"/"
(mapconcat (lambda (elm) elm)
(last p-lst 3)
"/"))
(mapconcat (lambda (elm) elm)
p-lst
"/")))
(split-string (pwd-repl-home (eshell/pwd)) "/")) 'face
`(:foreground "yellow"))
(or (curr-dir-git-branch-string (eshell/pwd)))
(propertize " # " 'face 'default))))
(setq eshell-highlight-prompt nil)
Thank you for all the work on emacs!
Regards,
Hrishi
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 08 Mar 2025 08:22:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 76853 <at> debbugs.gnu.org (full text, mbox):
Hrishikesh S <hrish2006 <at> gmail.com> writes:
> In GNU Emacs 30.1, System Description: macOS 15.2
>
> which I installed by simply running "brew install emacs" on my work machine,
> when I'm inside the eshell buffer, typing `M-b` does not take me back by a
> word like how it used to be.
>
> Apologies if the bug doesn't have enough information, but I was able to
> verify this behavior on a fresh, clean install, without any of my
> configuration or installed packages by running
>
> "emacs -Q" and observing the same behavior.
>
> I searched through existing bug reports and this seems like a new issue.
Jim, any comments?
> My relevant emacs config:
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
> eshell ;; (require 'em-smart) (setq eshell-history-size 10000) (setq
> eshell-prompt-regexp "^[^#$]*[#$] ")
>
>
> (defun curr-dir-git-branch-string (pwd)
> "Returns current git branch as a string, or the empty string if
> PWD is not in a git repo (or the git command is not found)."
> (interactive)
> (when (and (eshell-search-path "git")
> (locate-dominating-file pwd ".git"))
> (let ((git-output (shell-command-to-string (concat "cd " pwd " && git
> branch | grep '\\*' | sed -e 's/^\\* //'"))))
> (propertize (concat " ["
> (if (> (length git-output) 0)
> (substring git-output 0 -1)
> "(no branch)")
> "]") 'face `(:foreground "green"))
> )))
>
> (setq eshell-prompt-function
> (lambda ()
> (concat
> (propertize ((lambda (p-lst)
> (if (> (length p-lst) 3)
> (concat
> (mapconcat (lambda (elm) (if (zerop (length elm)) ""
> (substring elm 0 1)))
> (butlast p-lst 3)
> "/")
> "/"
> (mapconcat (lambda (elm) elm)
> (last p-lst 3)
> "/"))
> (mapconcat (lambda (elm) elm)
> p-lst
> "/")))
> (split-string (pwd-repl-home (eshell/pwd)) "/")) 'face
> `(:foreground "yellow"))
> (or (curr-dir-git-branch-string (eshell/pwd)))
> (propertize " # " 'face 'default))))
>
> (setq eshell-highlight-prompt nil)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 08 Mar 2025 18:06:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 76853 <at> debbugs.gnu.org (full text, mbox):
On 3/8/2025 12:21 AM, Stefan Kangas wrote:
> Hrishikesh S <hrish2006 <at> gmail.com> writes:
>
>> which I installed by simply running "brew install emacs" on my work machine,
>> when I'm inside the eshell buffer, typing `M-b` does not take me back by a
>> word like how it used to be.
[snip]
>
> Jim, any comments?
Like 'shell' has for a long time, Eshell now uses fields when
propertizing the prompt, and '(for|back)ward-word' don't move across
field boundaries by default. So this is the intended default behavior.
You could try setting 'inhibit-field-text-motion' to nil buffer-locally,
though maybe that's a drastic change. Is there a better way to do that?
(Or if not, should there be?)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Mon, 10 Mar 2025 03:13:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 76853 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I see.. Thanks for the response! I will try setting
`'inhibit-field-text-motion` and test.
I'm used to using `M-b` a lot when I'm inside eshell as it lets me copy
parts of my current directory when running commands
(e.g: copy the git branch I'm on before pushing, etc), so found the change
to be a bit jarring. As long as there is a way
to get back the old behavior, I have no complaints :)
Regards,
Hrishi
On Sat, Mar 8, 2025 at 10:05 AM Jim Porter <jporterbugs <at> gmail.com> wrote:
> On 3/8/2025 12:21 AM, Stefan Kangas wrote:
> > Hrishikesh S <hrish2006 <at> gmail.com> writes:
> >
> >> which I installed by simply running "brew install emacs" on my work
> machine,
> >> when I'm inside the eshell buffer, typing `M-b` does not take me back
> by a
> >> word like how it used to be.
> [snip]
> >
> > Jim, any comments?
>
> Like 'shell' has for a long time, Eshell now uses fields when
> propertizing the prompt, and '(for|back)ward-word' don't move across
> field boundaries by default. So this is the intended default behavior.
>
> You could try setting 'inhibit-field-text-motion' to nil buffer-locally,
> though maybe that's a drastic change. Is there a better way to do that?
> (Or if not, should there be?)
>
[Message part 2 (text/html, inline)]
Reply sent
to
Stefan Kangas <stefankangas <at> gmail.com>
:
You have taken responsibility.
(Mon, 10 Mar 2025 05:42:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Hrishikesh S <hrish2006 <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 10 Mar 2025 05:42:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 76853-done <at> debbugs.gnu.org (full text, mbox):
Hrishikesh S <hrish2006 <at> gmail.com> writes:
> I see.. Thanks for the response! I will try setting
> `'inhibit-field-text-motion` and test.
>
> I'm used to using `M-b` a lot when I'm inside eshell as it lets me copy
> parts of my current directory when running commands
> (e.g: copy the git branch I'm on before pushing, etc), so found the change
> to be a bit jarring. As long as there is a way
> to get back the old behavior, I have no complaints :)
Thanks, so I guess we can therefore close this bug.
I'm doing that with this message.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Fri, 14 Mar 2025 03:34:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 76853-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Stefan,
I tried this:
(add-hook 'eshell-mode-hook (lambda () (setq-local
inhibit-field-text-motion nil)))
but this doesn't work (retains current behavior and describe-variable says
that the default value for "inhibit-field-text-motion" is nil).
This worked:
(add-hook 'eshell-mode-hook (lambda () (setq-local
inhibit-field-text-motion t)))
but then I lose the completions I get when I type a command like `cd <tab>`
It would be nice if I could get back the behavior I was used to in emacs
29.
Currently, I'm managing by first hitting `C-b` followed by `M-b`.
:)
Regards,
Hrishi
On Sun, Mar 9, 2025 at 10:41 PM Stefan Kangas <stefankangas <at> gmail.com>
wrote:
> Hrishikesh S <hrish2006 <at> gmail.com> writes:
>
> > I see.. Thanks for the response! I will try setting
> > `'inhibit-field-text-motion` and test.
> >
> > I'm used to using `M-b` a lot when I'm inside eshell as it lets me copy
> > parts of my current directory when running commands
> > (e.g: copy the git branch I'm on before pushing, etc), so found the
> change
> > to be a bit jarring. As long as there is a way
> > to get back the old behavior, I have no complaints :)
>
> Thanks, so I guess we can therefore close this bug.
>
> I'm doing that with this message.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Fri, 14 Mar 2025 03:48:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 76853 <at> debbugs.gnu.org (full text, mbox):
On 3/13/2025 8:32 PM, Hrishikesh S wrote:
> This worked:
> (add-hook 'eshell-mode-hook (lambda () (setq-local
> inhibit-field-text-motion t)))
>
> but then I lose the completions I get when I type a command like `cd <tab>`
> It would be nice if I could get back the behavior I was used to in emacs
> 29.
> Currently, I'm managing by first hitting `C-b` followed by `M-b`.
That's unfortunate. I'm open to implementation options here. Stefan (or
anyone else who wants to chime in), do you think it would make sense to
say, "Users should be able to set 'inhibit-field-text-motion' to t in
Eshell," and that any problems with that are bugs to be fixed?
Or maybe we should handle this bug report in a different way?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 15 Mar 2025 12:38:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 76853 <at> debbugs.gnu.org (full text, mbox):
Jim Porter <jporterbugs <at> gmail.com> writes:
> On 3/13/2025 8:32 PM, Hrishikesh S wrote:
>> This worked:
>> (add-hook 'eshell-mode-hook (lambda () (setq-local
>> inhibit-field-text-motion t)))
>>
>> but then I lose the completions I get when I type a command like `cd <tab>`
>> It would be nice if I could get back the behavior I was used to in emacs
>> 29.
>> Currently, I'm managing by first hitting `C-b` followed by `M-b`.
>
> That's unfortunate. I'm open to implementation options here. Stefan (or
> anyone else who wants to chime in), do you think it would make sense to
> say, "Users should be able to set 'inhibit-field-text-motion' to t in
> Eshell," and that any problems with that are bugs to be fixed?
>
> Or maybe we should handle this bug report in a different way?
I don't have a strong opinion myself, but if we can fix that then it
does seem a bit better.
Maybe Stefan Monnier (in Cc) has some ideas.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 15 Mar 2025 14:09:05 GMT)
Full text and
rfc822 format available.
Message #31 received at 76853 <at> debbugs.gnu.org (full text, mbox):
>> This worked:
>> (add-hook 'eshell-mode-hook (lambda () (setq-local
>> inhibit-field-text-motion t)))
>> but then I lose the completions I get when I type a command like `cd
>> <tab>`
>> It would be nice if I could get back the behavior I was used to in
>> emacs 29.
>> Currently, I'm managing by first hitting `C-b` followed by `M-b`.
>
> That's unfortunate. I'm open to implementation options here. Stefan (or
> anyone else who wants to chime in), do you think it would make sense to say,
> "Users should be able to set 'inhibit-field-text-motion' to t in Eshell,"
> and that any problems with that are bugs to be fixed?
The `inhibit-*` variables are generally not considered configuration
variables, so we should look for other ways to provide the
desired behavior.
E.g. provide navigation commands which don't pay attention to field
boundaries, so Hrishi can bind this to `M-b`?
Or provide a config var which works a bit like
`inhibit-field-text-motion` but affects only the specific commands which
pay attention to it (and only when called interactively)?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76853
; Package
emacs
.
(Sat, 15 Mar 2025 21:03:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 76853 <at> debbugs.gnu.org (full text, mbox):
On 3/15/2025 7:07 AM, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
> The `inhibit-*` variables are generally not considered configuration
> variables, so we should look for other ways to provide the
> desired behavior.
>
> E.g. provide navigation commands which don't pay attention to field
> boundaries, so Hrishi can bind this to `M-b`?
> Or provide a config var which works a bit like
> `inhibit-field-text-motion` but affects only the specific commands which
> pay attention to it (and only when called interactively)?
Thanks, this is in line with what I was thinking, but was hesitant to
propose. I'll see about a patch along these lines.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 13 Apr 2025 11:24:52 GMT)
Full text and
rfc822 format available.
This bug report was last modified 70 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.