Subject: bug#76853: closed (Re: bug#76853: M-b not navigating to the previous word in the prompt string inside Eshell on emacs 30.1)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 10 Mar 2025 05:42:02 +0000

Your bug report

#76853: M-b not navigating to the previous word in the prompt string inside Eshell on emacs 30.1

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76853: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76853
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#76853: M-b not navigating to the previous word in the prompt string inside Eshell on emacs 30.1
From: Stefan Kangas <[email-masked]>
To: Hrishikesh S <[email-masked]>, Jim Porter <[email-masked]>
Cc: [email-masked]
Date: Mon, 10 Mar 2025 05:41:40 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hrishikesh S <[email-masked]> 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.

Subject: M-b not navigating to the previous word in the prompt string inside Eshell on emacs 30.1
From: Hrishikesh S <[email-masked]>
To: [email-masked]
Date: Fri, 7 Mar 2025 13:58:35 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

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