zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Prompt dir expansion after removing cwd's parent
Date: Wed, 8 Jun 2022 09:15:22 -0700	[thread overview]
Message-ID: <CAH+w=7Yg1rKcKN=FCiq0h1o8NU8KCuZySbHzRzhJp-rhZsQtxQ@mail.gmail.com> (raw)
In-Reply-To: <1644026654.700770.1654681319674@mail2.virginmedia.com>

On Wed, Jun 8, 2022 at 2:42 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> > On 08 June 2022 at 10:14 Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> >
> > With 5.9:

With any version of zsh ever, really.

> > Ideally I'd like to see some indication that cwd has been deleted, or
> > that a path to cwd couldn't be determined, etc..

IMO this happens so seldom that doing it before every prompt as a
shell default just seems like a huge waste of time, especially if
(say) the current directory is on a networked file system and there
may be a significant delay checking it.  If you're doing this to
yourself often enough to notice, put something in your precmd hooks to
discover it.

> It looks like prompts currently just passively look at the internal pwd
> variable, so make no kind of checks of the environment of any sort.

Intentionally so ...

> However, it looks like this has wider ramifications as it appears
> "pwd" and "pwd -P" both just shrug their shoulders and return
> the last known current directory in this case.

/*
 * Try to find the current directory.
 * If we couldn't work it out internally, fall back to getcwd().
 * If it fails, fall back to pwd; if zgetcwd() is being used
 * to set pwd, pwd should be NULL and we just return ".".
 */

As of workers/50287, we always fall back to getcwd() rather than "work
it out internally", so some of the foregoing may have subtly changed.


  reply	other threads:[~2022-06-08 16:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  9:14 Daniel Shahaf
2022-06-08  9:41 ` Peter Stephenson
2022-06-08 16:15   ` Bart Schaefer [this message]
2022-06-09  1:10     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Yg1rKcKN=FCiq0h1o8NU8KCuZySbHzRzhJp-rhZsQtxQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    --subject='Re: Prompt dir expansion after removing cwd'\''s parent' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).