]> git.eshelyaron.com Git - emacs.git/commitdiff
Support `shell-resync-dirs' on msys bash (Bug#70012)
authorSam Steingold <sds@gnu.org>
Fri, 29 Mar 2024 14:36:43 +0000 (10:36 -0400)
committerEshel Yaron <me@eshelyaron.com>
Fri, 29 Mar 2024 19:22:02 +0000 (20:22 +0100)
* lisp/shell.el (w32-application-type): Declare.
(shell-mode): Set `shell-dirstack-query' to `pwd -W` when using msys bash.

(cherry picked from commit 6f7cb96543285dc8e37135abaec87d0b9a40e2e2)

lisp/shell.el

index b02f5f117a979539aed0ad3e37b15b7566c31c7d..20f9587af9931c3cfb82ee461bac6a14552894e8 100644 (file)
@@ -606,6 +606,9 @@ Shell buffers.  It implements `shell-completion-execonly' for
 
 (defvar sh-shell-file)
 
+(declare-function w32-application-type nil ; "src/w32proc.c"
+                  (program) t)
+
 (define-derived-mode shell-mode comint-mode "Shell"
   "Major mode for interacting with an inferior shell.
 \\<shell-mode-map>
@@ -754,6 +757,11 @@ command."
                  ((string-equal shell "ksh") "echo $PWD ~-")
                  ;; Bypass any aliases.  TODO all shells could use this.
                  ((string-equal shell "bash") "command dirs")
+                 ((and (string-equal shell "bash.exe")
+                        (eq system-type 'windows-nt)
+                        (eq (w32-application-type (executable-find "bash.exe"))
+                            'msys))
+                   "command pwd -W")
                  ((string-equal shell "zsh") "dirs -l")
                  (t "dirs")))
       ;; Bypass a bug in certain versions of bash.