zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Oliver Kiddle <opk@u.genie.co.uk>
Cc: Zsh users <zsh-users@sunsite.auc.dk>
Subject: Re: some directory changing tools to share
Date: Tue, 7 Mar 2000 17:46:28 +0000	[thread overview]
Message-ID: <1000307174628.ZM5401@candle.brasslantern.com> (raw)
In-Reply-To: <38C4E2BE.AF06B2F7@u.genie.co.uk>

On Mar 7, 11:06am, Oliver Kiddle wrote:
} Subject: Re: some directory changing tools to share
}
} This reminds me of a useful feature of 4DOS (a shareware command.com
} replacement which I used to use) and I think also for shared drives in
} Netware. It allowed series of dots to refer to parent directories beyond
} the parent. So, ... refers to the parent of the parent, .... to the
} parent of that etc.

How about this?

  preexec() {
    setopt localoptions extendedglob
    if [[ -o autocd && $1 = ...# ]]
    then
      eval function $1 \{ cd ..${${1#..}:gs@.@/..}\; unfunction $1 \}
      alias -g $1="..${${1#..}:gs@.@/..}"
    fi
  }

Works sort of like named dirs; once you type "....." as a command, it
cd's you there and thereafter refers everywhere to "../../../..".  For
any number of dots greater than 2.  Not quite globbing.

} Would it be possible to add an option which extends the zsh filename
} generation to expand ... to ../.., .... to ../../.. etc. Would this
} conflict with any of the existing globbing system?

It probably wouldn't conflict with file globbing, but as the globbing
system is used for pattern matching in `case' and [[ ]] expressions,
I'd be leery of introducing (a) directory-hierarchy-specific expansion
and (b) yet another metacharacter, which is in effect what `.' would
become.  Perhaps (#...) or something like that.

By the way, in 3.0.7 this works:

zagzig% setopt extendedglob
zagzig% cd /usr/src/local/zsh/zsh-3.1.6
zagzig% echo (../)#
 ../ ../../ ../../../ ../../../../ ../../../../../

But in 3.1.6 it crashes the shell:

zagzig% setopt extendedglob
zagzig% cd /usr/src/local/zsh/zsh-3.1.6
zagzig% echo (../)#
BUG: statfullpath(): pathname too long
zsh: segmentation fault (core dumped)  $ZSH_NAME -f

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      reply	other threads:[~2000-03-07 17:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-06 21:14 mkkwong
2000-03-07  0:32 ` Zefram
2000-03-07  7:36   ` Andrej Borsenkow
2000-03-07 15:33   ` mkkwong
2000-03-07 11:06 ` Oliver Kiddle
2000-03-07 17:46   ` Bart Schaefer [this message]

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=1000307174628.ZM5401@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=opk@u.genie.co.uk \
    --cc=zsh-users@sunsite.auc.dk \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).