zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: add preserve-prefix to compinstall
Date: Fri, 07 Mar 2003 15:08:48 +0000	[thread overview]
Message-ID: <15356.1047049728@csr.com> (raw)

This adds preserve-prefix handling to compinstall's file section,
because I only just discovered it stopped me needing fake-files under
Cygwin.

Index: Completion/compinstall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/compinstall,v
retrieving revision 1.6
diff -u -r1.6 compinstall
--- Completion/compinstall	9 Oct 2001 11:17:05 -0000	1.6
+++ Completion/compinstall	7 Mar 2003 15:06:34 -0000
@@ -1529,7 +1529,7 @@
 #       squeeze-slashes,
 __ci_do_file_styles() {
   local key files cursor expand speciald ignorep squeezes select
-  local prefon suffon lssuffixes
+  local prefon suffon lssuffixes preserve
 
   __ci_get_this_style file-sort files
   __ci_get_this_style ignore-parents ignorep
@@ -1537,6 +1537,8 @@
   __ci_get_this_style squeeze-slashes squeezes
   __ci_get_this_style expand expand
   __ci_get_this_style list-suffixes lssuffixes
+  __ci_get_this_style preserve-prefix preserve
+  [[ -n $preserve ]] && preserve=${(Q)preserve}
 
   while true; do
     clear
@@ -1554,6 +1556,8 @@
 5.  Configure how multiple paths are expanded and displayed, 
     e.g. /f/b -> /foo/bar
 
+6.  Keep certain prefixes unchanged, such as \`//resource/'.
+
 q.  Return without saving.
 0.  Done setting options for filename completion.
 "
@@ -1729,6 +1733,21 @@
 	    ([nN]) lssuffixes=;;
 	  esac
 	  ;;
+      (6) print "\
+On some systems, there are special forms for the start of a filename
+which should be left alone by the completion system.  For example, Cygwin
+uses a double slash to indicate a network resource, hence a prefix of
+the form \`//resource/' should be left alone.  This style gives a pattern
+to match any such prefixes; alternatives separated by \`|' are therefore
+possible.  Edit the pattern as you like.  If this is empty, the shell will not
+handle any prefixes specially."
+          if [[ -z $preserve ]]; then
+	      preserve="//[^/]##/"
+	      print "
+Accept the default to handle network resources as just described."
+	  fi
+	  vared -eh -p "pattern> " preserve
+	  ;;
       (q) return 1
 	 ;;
     esac
@@ -1741,6 +1760,9 @@
   __ci_set_this_style squeeze-slashes squeezes
   __ci_set_this_style expand expand
   __ci_set_this_style list-suffixes lssuffixes
+  # pattern, always quote
+  [[ -n $preserve ]] && preserve=${(qq)preserve}
+  __ci_set_this_style preserve-prefix preserve
 
   return 0
 }

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


                 reply	other threads:[~2003-03-07 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=15356.1047049728@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.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).