From 54be46728d67673ebeb609d901988cfea58828a6 Mon Sep 17 00:00:00 2001 From: rupa Date: Mon, 27 May 2013 14:16:38 -0400 Subject: [PATCH] Append, rather than prepend to PROMPT_COMMAND --- README | 8 ++++---- z.1 | 2 +- z.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index 0e0a6c5..4257001 100644 --- a/README +++ b/README @@ -71,7 +71,7 @@ NOTES Frecency: Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted - rank that depends on how often and how recently something occurred. As + rank that depends on how often and how recently something occurred. As far as I know, Mozilla came up with the term. To z, a directory that has low ranking but has been accessed recently @@ -109,9 +109,9 @@ ENVIRONMENT resolving of symlinks. If it is not set, symbolic links will be resolved when added to the datafile. - In bash, z prepends a command to the PROMPT_COMMAND environment vari- - able to maintain its database. In zsh, z appends a function _z_precmd - to the precmd_functions array. + In bash, z appends a command to the PROMPT_COMMAND environment variable + to maintain its database. In zsh, z appends a function _z_precmd to the + precmd_functions array. The environment variable $_Z_NO_PROMPT_COMMAND can be set if you want to handle PROMPT_COMMAND or precmd yourself. diff --git a/z.1 b/z.1 index b84d928..4d2a607 100644 --- a/z.1 +++ b/z.1 @@ -134,7 +134,7 @@ The environment variable \fB$_Z_NO_RESOLVE_SYMLINKS\fR can be set to prevent resolving of symlinks. If it is not set, symbolic links will be resolved when added to the datafile. .P -In bash, \fBz\fR prepends a command to the \fBPROMPT_COMMAND\fR environment +In bash, \fBz\fR appends a command to the \fBPROMPT_COMMAND\fR environment variable to maintain its database. In zsh, \fBz\fR appends a function \fB_z_precmd\fR to the \fBprecmd_functions\fR array. .P diff --git a/z.sh b/z.sh index 883ed3d..7e153f0 100644 --- a/z.sh +++ b/z.sh @@ -218,7 +218,7 @@ elif complete &> /dev/null; then [ "$_Z_NO_PROMPT_COMMAND" ] || { # bash populate directory list. avoid clobbering other PROMPT_COMMANDs. echo $PROMPT_COMMAND | grep -q "_z --add" || { - PROMPT_COMMAND='_z --add "$(pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;'"$PROMPT_COMMAND" + PROMPT_COMMAND="${PROMPT_COMMAND%;}"';_z --add "$(pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;' } } fi