Skip to content

PS1 environment variable modified after requiring ghostel on MSYS2 bash #531

Description

@zHaOdANiuu

Thank you for supporting the Windows platform — it's great to be able to use ghostel on Windows.

However, I've encountered an issue with environment variables being modified when running under MSYS2 bash.

  • Shell: MINGW64_NT-10.0-19045 (3.6.9-01d6c708.x86_64, 2026-05-24)
  • OS: Microsoft Windows [Version 10.0.19045.3803]
  • Emacs: GNU Emacs 32.0.50 (Development version d7b070b74c5f, built 2026-07-10)

Problem

When I launch ghostel, environment variables inherited from the terminal are altered after requiring ghostel. Specifically, the PS1 variable (bash prompt) gets changed, which modifies my shell prompt unexpectedly.

Steps to Reproduce

  1. Start Emacs with emacs -Q
  2. Evaluate the following code:
;; Check PS1 value before requiring ghostel
(getenv "PS1")
;; => e.g. "expected prompt value"

(progn
  (package-initialize)
  (require 'ghostel))

;; Check PS1 value after requiring ghostel
(getenv "PS1")
;; => e.g. "unexpected modified prompt value"
  1. Observe that PS1 has been changed after requiring ghostel.

Expected Behavior

PS1 and other inherited environment variables should remain unchanged after requiring ghostel.

Actual Behavior

After requiring ghostel, PS1 is modified, which causes the bash prompt to change from its expected appearance.

Normal prompt:

Image

After ghostel:

Image

The workaround is simple — just restore the environment variables to their original values after requiring ghostel.

(progn
  (package-initialize)
  (require 'ghostel)
  (setenv "PS1" "\\[\\e]0;\\w\\a\\]\\n\\[\\e[32m\\]\\u@\\h \\[\\e[35m\\]$MSYSTEM\\[\\e[0m\\] \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\$ "))
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions