Subject: bug#79441: shell-resync-dirs breaks on PS1 with newline

From: Janneke Nieuwenhuizen <[email-masked]>
Date: Sat, 13 Sep 2025 08:52:15 +0200

Hi!

It's great that shell-resync-dirs no longer hangs, but now (30.2) it
breaks on my prompt:

--8<---------------cut here---------------start------------->8---
PS1='$(_q=$?; if [ $_q != 0 ]; then echo "[$_q] ";fi)\t \u@\h:\w'" $PSG"'\n$ '
--8<---------------cut here---------------end--------------->8---

saying

    Couldn’t cd: (wrong-type-argument stringp nil)

and failing to update the buffer's directory.

I've been using it for ages: It shows the last exit value if non-zero,
the time, the user, pwd and uses a newline always leave plenty of typing
space.  (PSG is set to "[env]" when inside a GUIX_ENVIRONMENT.)

Anyway, typing:

    PS1='$ '

(or even PS1='\w$ ') fixes it, i.e., M-RET works again.  To reproduce, a
single character (that is not '.') and a newline suffices, typing
something like:

    PS1='0\n$ '

in an emacs shell and typing M-RET reproduces the problem.

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen <[email-masked]>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com