zsh-workers
 help / color / mirror / code / Atom feed
* setopt localoptions noautoremoveslash
@ 1999-10-14 17:09 Tanaka Akira
  1999-10-14 17:15 ` Zefram
  0 siblings, 1 reply; 12+ messages in thread
From: Tanaka Akira @ 1999-10-14 17:09 UTC (permalink / raw)
  To: zsh-workers

Why is `setopt localoptions noautoremoveslash' not effective?
Is this intended behaviour?

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { setopt localoptions noautoremoveslash; compgen -/ }
is27e1u11% tst Do<TAB>
->
is27e1u11% tst Doc/<SPACE>
->
is27e1u11% tst Doc 

I noticed this with _urls. In URL context, trailing slash should not
autoremoved.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: setopt localoptions noautoremoveslash
  1999-10-14 17:09 setopt localoptions noautoremoveslash Tanaka Akira
@ 1999-10-14 17:15 ` Zefram
  1999-10-14 18:08   ` Tanaka Akira
  1999-10-15  3:15   ` setopt localoptions noautoremoveslash Wayne Davison
  0 siblings, 2 replies; 12+ messages in thread
From: Zefram @ 1999-10-14 17:15 UTC (permalink / raw)
  To: Tanaka Akira; +Cc: zsh-workers

Tanaka Akira wrote:
>Why is `setopt localoptions noautoremoveslash' not effective?

AUTO_REMOVE_SLASH takes effect at a completely different stage of
processing from when the completion list is being generated.  The option
was changed locally within your completion widget, making no difference,
and then the original setting took effect as normal when the completion
was inserted.

>I noticed this with _urls. In URL context, trailing slash should not
>autoremoved.

The removable suffix ought to be completely under user control, set on a
per-match basis.  (Some of the built-in completions, such as completion
after $, already give different removable suffixes for different matches.)
AUTO_REMOVE_SLASH is only intended to apply to normal directory completion.

-zefram


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: setopt localoptions noautoremoveslash
  1999-10-14 17:15 ` Zefram
@ 1999-10-14 18:08   ` Tanaka Akira
  1999-10-15 11:24     ` PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Oliver Kiddle
  1999-10-15  3:15   ` setopt localoptions noautoremoveslash Wayne Davison
  1 sibling, 1 reply; 12+ messages in thread
From: Tanaka Akira @ 1999-10-14 18:08 UTC (permalink / raw)
  To: zsh-workers

In article <E11boTW-0002tB-00@crucigera.fysh.org>,
  Zefram <zefram@fysh.org> writes:

> The removable suffix ought to be completely under user control, set on a
> per-match basis.  (Some of the built-in completions, such as completion
> after $, already give different removable suffixes for different matches.)
> AUTO_REMOVE_SLASH is only intended to apply to normal directory completion.

I see. I modifed _urls to call _path_files twice: for directories
and other files.

Index: Completion/User/_urls
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.1.1.7
diff -u -F^( -r1.1.1.7 _urls
--- Completion/User/_urls	1999/10/13 17:50:35	1.1.1.7
+++ Completion/User/_urls	1999/10/14 18:02:54
@@ -2,7 +2,7 @@
 
 # Usage: _urls [-f]
 # Options:
-#  -f : complete files.
+#  -f : complete files first.
 #
 # Configuration keys used:
 #
@@ -38,84 +38,89 @@
 #    e.g. compconf urls_localhttp=www:/usr/local/apache/htdocs:public_html
 
 local ipre scheme host user dirs files ret=1 expl
+local urls_path="${compconfig[urls_path]:-${ZDOTDIR:-$HOME}/.zsh/urls}"
+local localhttp_servername="${${(@s.:.)compconfig[urls_localhttp]}[1]}"
+local localhttp_documentroot="${${(@s.:.)compconfig[urls_localhttp]}[2]}"
+local localhttp_userdir="${${(@s.:.)compconfig[urls_localhttp]}[3]}"
 
 if [[ "$1" = -f ]]; then
   shift
   _files "$@" && return
 fi
 
-if [[ -z "$compconfig[urls_path]" ]]; then
-  compconfig[urls_path]=${ZDOTDIR:-$HOME}/.zsh/urls
-fi
-
 ipre="$IPREFIX"
 
-if [[ -prefix [-+.a-z0-9]#: ]]; then
-  scheme="${PREFIX%%:*}"
-  compset -P "[-+.a-z0-9]#:"
-else
+if ! [[ -prefix [-+.a-z0-9]#: ]]; then
   _description expl 'URL prefix'
-  [[ -d $compconfig[urls_path]/bookmark ]] &&
-      compadd "$@" "$expl[@]" -S '' bookmark: && ret=0
+  [[ -d $urls_path/bookmark ]] &&
+    compadd "$@" "$expl[@]" -S '' bookmark: && ret=0
   compadd "$@" "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
   return $ret
 fi
 
+scheme="${PREFIX%%:*}"
+compset -P "[-+.a-z0-9]#:"
+
 case "$scheme" in
-  http|ftp|gopher) compset -P // || { compadd "$@" -S '' //; return };;
+  http|ftp|gopher)
+    if ! compset -P //; then
+      compadd "$@" -S '' //
+      return
+    fi
+  ;;
   file)
     if ! compset -P //; then
       if [ -prefix / ]; then
 	_files "$@"
-	return
       elif [ ! "$PREFIX" ]; then
 	compadd -S '/' - "${PWD%/}"
-	return
       fi
+      return
     fi
   ;;
   bookmark)
-    if [[ -f "$compconfig[urls_path]/$scheme/$PREFIX$SUFFIX" &&
-        -s "$compconfig[urls_path]/$scheme/$PREFIX$SUFFIX" ]]; then
-      compadd "$@" -QU -- \
-          "$ipre$(<"$compconfig[urls_path]/$scheme/$PREFIX$SUFFIX")"
+    if [[ -f "$urls_path/$scheme/$PREFIX$SUFFIX" &&
+	  -s "$urls_path/$scheme/$PREFIX$SUFFIX" ]]; then
+      compadd "$@" -QU -- "$ipre$(<"$urls_path/$scheme/$PREFIX$SUFFIX")" && ret=0
     else
-      compadd "$@" -Q -S '/' - \
-          $compconfig[urls_path]/$scheme/$PREFIX*$SUFFIX(/:t) && ret=0
-      compadd "$@" -QS '' - \
-          $compconfig[urls_path]/$scheme/$PREFIX*$SUFFIX(.:t) || return $ret
+      _description expl 'bookmark'
+      _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && ret=0
+      _path_files -W "$urls_path/$scheme" -S/ -r '' -/ && ret=0
     fi
-    return 
+    return $ret
   ;;
 esac
 
-if [[ -prefix */* ]]; then
+# Complete hosts
+if ! [[ -prefix */* ]]; then
+  dirs=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
+  (( $#dirs )) || _hosts -S/ && ret=0
+  [ "$scheme" = "http" ] && 
+    dirs=($dirs $localhttp_servername)
+  compadd "$@" -QS/ - $dirs && ret=0
+  return $ret
+fi
 
-  # Complete part after hostname
-  host=${PREFIX%%/*}
-  compset -P "$host/"
-  if [[ "$compconfig[urls_localhttp]" = ${host}:* ]]; then
-    if [[ -prefix \~ ]]; then
-      compset -P \~
-      if [[ -prefix */* ]]; then
-        user=${PREFIX%%/*}
-	compset -P $user/
-	_path_files -W ~$user/${${(s.:.)compconfig[urls_localhttp]}[3]}/
-      else
-        _users -S/
-      fi
+# Complete part after hostname
+host=${PREFIX%%/*}
+compset -P "$host/"
+if [[ "$compconfig[urls_localhttp]" = ${host}:* ]]; then
+  if [[ -prefix \~ ]]; then
+    compset -P \~
+    if [[ -prefix */* ]]; then
+      user=${PREFIX%%/*}
+      compset -P $user/
+      _path_files -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
+      _path_files -W ~$user/$localhttp_userdir -S/ -r '' -/ && ret=0
     else
-      _path_files -W ${${(s.:.)compconfig[urls_localhttp]}[2]}
+      _users -S/ && ret=0
     fi
   else
-    _path_files -W $compconfig[urls_path]/$scheme/$host/
+    _path_files -W $localhttp_documentroot -g '*(^/)' && ret=0
+    _path_files -W $localhttp_documentroot -S/ -r '' -/ && ret=0
   fi
 else
-
-  # Complete hosts
-  dirs=($compconfig[urls_path]/$scheme/$PREFIX*$SUFFIX(/:t))
-  (( $#dirs )) || _hosts -S/ && ret=0
-  [ "$scheme" = "http" ] && 
-      dirs=($dirs ${${(s.:.)compconfig[urls_localhttp]}[1]})
-  compadd "$@" -Q -S '/' - $dirs || return $ret
+  _path_files -W $urls_path/$scheme/$host/ -g '*(^/)' && ret=0
+  _path_files -W $urls_path/$scheme/$host/ -S/ -r '' -/ && ret=0
 fi
+return $ret
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: setopt localoptions noautoremoveslash
  1999-10-14 17:15 ` Zefram
  1999-10-14 18:08   ` Tanaka Akira
@ 1999-10-15  3:15   ` Wayne Davison
  1 sibling, 0 replies; 12+ messages in thread
From: Wayne Davison @ 1999-10-15  3:15 UTC (permalink / raw)
  To: Zefram; +Cc: Zsh Workers

On Thu, 14 Oct 1999, Zefram wrote:
> AUTO_REMOVE_SLASH takes effect at a completely different stage of
> processing from when the completion list is being generated.

This reminds me that I have an idea for how to implement a better
auto-slash functionality (IMO, at least).  See if you like this
idea:

I would like an auto-added slash to be inserted into the buffer as a
special meta character (call it meta-/ for now) that has special
properties.  I imagine this character displaying itself in reverse
video _only_ if it is going to be removed when I press return (it is
not removed before that unless you type a '/' right next to it).
The command-line display routine would check the character to the
right of the meta-/ to determine how to draw the character.

To me, this would be cool because the character retains it auto-
removal magic even if I accidently type a normal character to the
right of it and then fix my typing mistake.  You could even have the
embedded (non-removed) meta-slashes keep their magic intact in the
history buffer if you want to be able to recall a command line,
delete a suffix, and have the auto-added slash invert itself to
indicate that it will auto-remove on return.  If we go this route
(of putting embedded meta-slashes into the history buffer), we'd
have to remember to make all the history-search functions treat '/'
and meta-/ as equivalent.

Yeah, maybe it's over-kill, but I've been meaning to code it up to
see how I like it.  Anyone else think it's an interesting idea?

..wayne..


^ permalink raw reply	[flat|nested] 12+ messages in thread

* PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
  1999-10-14 18:08   ` Tanaka Akira
@ 1999-10-15 11:24     ` Oliver Kiddle
  1999-10-15 14:36       ` Tanaka Akira
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver Kiddle @ 1999-10-15 11:24 UTC (permalink / raw)
  To: Zsh workers

Tanaka Akira wrote:
> 
> I see. I modifed _urls to call _path_files twice: for directories
> and other files.

This is also applicable for the file url. Also, another slash is the one character which should remove the auto-inserted slash.

One strange behaviour I find with completing urls is that with urls_localhttpd set, when I complete user directories, menu selection is entered imediately rather than waiting for a second tab:
e.g: netscape http://risc10/~<tab> will insert 'ada' and give me the list with 'ada' selected rather than just giving me the list. This behaviour continues when completing files and directories after the username.

I've also noticed that with this dual file/directory completion and description_format set, I get 'file' aswell as 'directory' at the top of the list even if there were no files to complete.

Oliver Kiddle

--- Completion/Users/_urls.ta	Fri Oct 15 11:21:05 1999
+++ Completion/Users/_urls	Fri Oct 15 12:12:45 1999
@@ -70,11 +70,13 @@
   file)
     if ! compset -P //; then
       if [ -prefix / ]; then
-	_files "$@"
+	_path_files "$@" -S '' -g '*(^/)' && ret=0
+	_path_files "$@" -S/ -r '/' -/ && ret=0
       elif [ ! "$PREFIX" ]; then
-	compadd -S '/' - "${PWD%/}"
+	compadd -S '/' -r '/' - "${PWD%/}"
+	ret=0
       fi
-      return
+      return $ret
     fi
   ;;
   bookmark)
@@ -84,7 +86,7 @@
     else
       _description expl 'bookmark'
       _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && ret=0
-      _path_files -W "$urls_path/$scheme" -S/ -r '' -/ && ret=0
+      _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0
     fi
     return $ret 
   ;;
@@ -94,8 +96,7 @@
 if ! [[ -prefix */* ]]; then
   dirs=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
   (( $#dirs )) || _hosts -S/ && ret=0
-  [ "$scheme" = "http" ] && 
-    dirs=($dirs $localhttp_servername)
+  [ "$scheme" = "http" ] && dirs=($dirs $localhttp_servername)
   compadd "$@" -QS/ - $dirs && ret=0
   return $ret
 fi
@@ -103,23 +104,23 @@
 # Complete part after hostname
 host=${PREFIX%%/*}
 compset -P "$host/"
-if [[ "$compconfig[urls_localhttp]" = ${host}:* ]]; then
+if [[ "$localhttp_servername" = $host ]]; then
   if [[ -prefix \~ ]]; then
     compset -P \~
     if [[ -prefix */* ]]; then
       user=${PREFIX%%/*}
       compset -P $user/
       _path_files -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
-      _path_files -W ~$user/$localhttp_userdir -S/ -r '' -/ && ret=0
+      _path_files -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
     else
       _users -S/ && ret=0
     fi
   else
     _path_files -W $localhttp_documentroot -g '*(^/)' && ret=0
-    _path_files -W $localhttp_documentroot -S/ -r '' -/ && ret=0
+    _path_files -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
   fi
 else
   _path_files -W $urls_path/$scheme/$host/ -g '*(^/)' && ret=0
-  _path_files -W $urls_path/$scheme/$host/ -S/ -r '' -/ && ret=0
+  _path_files -W $urls_path/$scheme/$host/ -S/ -r '/' -/ && ret=0
 fi
 return $ret


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
  1999-10-15 11:24     ` PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Oliver Kiddle
@ 1999-10-15 14:36       ` Tanaka Akira
  0 siblings, 0 replies; 12+ messages in thread
From: Tanaka Akira @ 1999-10-15 14:36 UTC (permalink / raw)
  To: Zsh workers

This is another refinement for _urls.

* _urls is used as completion function of `curl'
 (http://curl.haxx.nu/)
* Use [[ ... ]] instead of [ ... ].
* Use (#b) in an argument of compset -P to extract info.
* Eliminate unused variable.

Index: Completion/User/_urls
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.1.1.9
diff -u -F^( -r1.1.1.9 _urls
--- Completion/User/_urls	1999/10/15 13:09:11	1.1.1.9
+++ Completion/User/_urls	1999/10/15 14:28:55
@@ -1,4 +1,4 @@
-#autoload
+#compdef curl
 
 # Usage: _urls [-f]
 # Options:
@@ -37,7 +37,9 @@
 #    name used by a user placing web pages within their home area.
 #    e.g. compconf urls_localhttp=www:/usr/local/apache/htdocs:public_html
 
-local ipre scheme host user dirs files ret=1 expl
+setopt localoptions extendedglob
+
+local ipre scheme host user hosts ret=1 expl
 local urls_path="${compconfig[urls_path]:-${ZDOTDIR:-$HOME}/.zsh/urls}"
 local localhttp_servername="${${(@s.:.)compconfig[urls_localhttp]}[1]}"
 local localhttp_documentroot="${${(@s.:.)compconfig[urls_localhttp]}[2]}"
@@ -50,16 +52,14 @@
 
 ipre="$IPREFIX"
 
-if ! [[ -prefix [-+.a-z0-9]#: ]]; then
+if ! compset -P '(#b)([-+.a-z0-9]#):'; then
   _description expl 'URL prefix'
   [[ -d $urls_path/bookmark ]] &&
     compadd "$@" "$expl[@]" -S '' bookmark: && ret=0
   compadd "$@" "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
   return $ret
 fi
-
-scheme="${PREFIX%%:*}"
-compset -P "[-+.a-z0-9]#:"
+scheme="$match[1]"
 
 case "$scheme" in
   http|ftp|gopher)
@@ -70,10 +70,10 @@
   ;;
   file)
     if ! compset -P //; then
-      if [ -prefix / ]; then
+      if [[ -prefix / ]]; then
 	_path_files "$@" -S '' -g '*(^/)' && ret=0
 	_path_files "$@" -S/ -r '/' -/ && ret=0
-      elif [ ! "$PREFIX" ]; then
+      elif [[ -z "$PREFIX" ]]; then
 	compadd -S '/' -r '/' - "${PWD%/}"
 	ret=0
       fi
@@ -94,34 +94,31 @@
 esac
 
 # Complete hosts
-if ! [[ -prefix */* ]]; then
-  dirs=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
-  (( $#dirs )) || _hosts -S/ && ret=0
-  [ "$scheme" = "http" ] && dirs=($dirs $localhttp_servername)
-  compadd "$@" -QS/ - $dirs && ret=0
+if ! compset -P '(#b)([^/]#)/'; then
+  hosts=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
+  (( $#hosts )) || _hosts -S/ && ret=0
+  [[ "$scheme" = http ]] && hosts=($hosts $localhttp_servername)
+  compadd "$@" -QS/ - $hosts && ret=0
   return $ret
 fi
+host="$match[1]"
 
 # Complete part after hostname
-host=${PREFIX%%/*}
-compset -P "$host/"
-if [[ "$localhttp_servername" = $host ]]; then
-  if [[ -prefix \~ ]]; then
-    compset -P \~
-    if [[ -prefix */* ]]; then
-      user=${PREFIX%%/*}
-      compset -P $user/
-      _path_files -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
-      _path_files -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
-    else
-      _users -S/ && ret=0
+if [[ "$localhttp_servername" = "$host" ]]; then
+  if compset -P \~; then
+    if ! compset -P '(#b)([^/]#)/'; then
+      _users -S/
+      return
     fi
+    user="$match[1]"
+    _path_files -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
+    _path_files -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
   else
     _path_files -W $localhttp_documentroot -g '*(^/)' && ret=0
     _path_files -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
   fi
 else
-  _path_files -W $urls_path/$scheme/$host/ -g '*(^/)' && ret=0
-  _path_files -W $urls_path/$scheme/$host/ -S/ -r '/' -/ && ret=0
+  _path_files -W $urls_path/$scheme/$host -g '*(^/)' && ret=0
+  _path_files -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0
 fi
 return $ret
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
@ 1999-10-18  9:41 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 1999-10-18  9:41 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> I tracked down the first problem to setopt glob_complete. i.e, the
> following is sufficient to cause the problem:

Ah, that helped. The problem was the `-f' business: it first tried to
match files. That found the `~' and with extendedglob set that made
the string look like a pattern, so the C-code set a flag
(`haspattern') which triggered menu-completion. The fix is to reset
that flag if no matches could be generated.

I also found out that `_tilde' wans't using `_users' yet.

> With respect to the second problem, I think I was just confused by the
> fact that I got a listing which looks like:
> file
> directory
> fred/    joe
> when I expected the file to appear before 'directory' so sorry for not
> checking it before I sent the mail.

A more verbose `description_format' might help here...

Bye
 Sven

diff -u oldsrc/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- oldsrc/Zle/zle_tricky.c	Mon Oct 18 11:17:17 1999
+++ Src/Zle/zle_tricky.c	Mon Oct 18 11:37:21 1999
@@ -4026,7 +4026,7 @@
     char **aign = NULL, **dparr = NULL, oaq = autoq, *oppre = dat->ppre;
     char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL;
     int lpl, lsl, pl, sl, bpl, bsl, bppl = -1, bssl = -1;
-    int llpl = 0, llsl = 0, nm = mnum, gflags = 0;
+    int llpl = 0, llsl = 0, nm = mnum, gflags = 0, ohp = haspattern;
     int oisalt = 0, isalt, isexact, doadd, ois = instring, oib = inbackt;
     Cline lc = NULL;
     Cmatch cm;
@@ -4333,6 +4333,9 @@
     qipre = oqp;
     qisuf = oqs;
 
+    if (mnum == nm)
+	haspattern = ohp;
+
     return (mnum == nm);
 }
 
@@ -6258,6 +6261,7 @@
 makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 {
     int t, sf1, sf2, ooffs, um = usemenu, delit, oaw, gflags;
+    int mn = mnum, ohp = haspattern;
     char *p, *sd = NULL, *tt, *s1, *s2, *os =  dupstring(s);
     struct cmlist ms;
 
@@ -7173,6 +7177,9 @@
     uremnode(ccstack, firstnode(ccstack));
     if (cc->matcher)
 	mstack = mstack->next;
+
+    if (mn == mnum)
+	haspattern = ohp;
 }
 
 /* Invalidate the completion list. */
diff -u -r oldcompletion/Base/_tilde Completion/Base/_tilde
--- oldcompletion/Base/_tilde	Mon Oct 18 11:17:45 1999
+++ Completion/Base/_tilde	Mon Oct 18 11:26:30 1999
@@ -39,12 +39,12 @@
   _description d 'directory stack'
   compadd "$d[@]" -V dirs -S/ -ld lines -Q - "$list[@]" 
 else
+  _users "$@"
   if (( $# )); then
     d=( "$@" )
   else
-    _description d 'user or named directory'
+    _description d 'named directory'
   fi
-
-  compgen "$d[@]" -nu "$s[@]"
+  compgen "$d[@]" -n "$s[@]"
 fi
 

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
  1999-10-15 15:30 ` Oliver Kiddle
       [not found]   ` <991015155008.ZM24081@candle.brasslantern.com>
@ 1999-10-16 13:56   ` Tanaka Akira
  1 sibling, 0 replies; 12+ messages in thread
From: Tanaka Akira @ 1999-10-16 13:56 UTC (permalink / raw)
  To: zsh-workers

In article <38074889.6DCA13F@u.genie.co.uk>,
  Oliver Kiddle <opk@u.genie.co.uk> writes:

> > -#autoload
> > +#compdef curl
> 
> Shouldn't this be done in _webbrowser. Or we should do what I suggested
> before which is to ditch _webbrowser, add the programs to a compdef in
> _urls and negate the meaning of -f to _urls.

I don't think so.  The name of the function should show its (default)
behaviour.  If _urls complete files by default, it should be renamed
to _filesurls or some similar name.

> 
> > * Use [[ ... ]] instead of [ ... ].
> 
> Could someone please explain why [[ ... ]] seems to be prefered where
> both forms provide the same functionality ? Sven also changed my use of
> [ -d ... ] to use the double square brackets. Is it faster or something?

I'm not sure about this.  But I believe the description of `test' in
zshbuiltins(1).
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
  1999-10-15 16:05     ` Oliver Kiddle
@ 1999-10-15 16:40       ` Bart Schaefer
  0 siblings, 0 replies; 12+ messages in thread
From: Bart Schaefer @ 1999-10-15 16:40 UTC (permalink / raw)
  To: Zsh workers

On Oct 15,  5:05pm, Oliver Kiddle wrote:
} Subject: Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash
}
} The patch is correct: extendedglob is required by _urls.

The patch is broken at my end by line folding in transit ... but it's
also subsumed by Tanaka's 8286.

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
       [not found]   ` <991015155008.ZM24081@candle.brasslantern.com>
@ 1999-10-15 16:05     ` Oliver Kiddle
  1999-10-15 16:40       ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver Kiddle @ 1999-10-15 16:05 UTC (permalink / raw)
  To: Zsh workers

Bart Schaefer wrote:
> 
> On Oct 15,  4:30pm, Oliver Kiddle wrote:
> } Subject: Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash
> }
> } In the process, I established that _urls requires globcomplete; patch
> } follows.
> }
> } +setopt localoptions extendedglob
> } +
> 
> So which is it?

Sorry, the beers from lunch time in the pub are stopping me thinking
properly :) The patch is correct: extendedglob is required by _urls. I
got mixed up with globcomplete which is the option that causes the
problem I described before with menu selection kicking in early.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
  1999-10-15 12:10 PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Sven Wischnowsky
@ 1999-10-15 15:30 ` Oliver Kiddle
       [not found]   ` <991015155008.ZM24081@candle.brasslantern.com>
  1999-10-16 13:56   ` Tanaka Akira
  0 siblings, 2 replies; 12+ messages in thread
From: Oliver Kiddle @ 1999-10-15 15:30 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky wrote:
 
> Do you mean to say that you still get this or that you fixed it? At
> least I don't get either of these after your patch. If you still get
> them, I need more information about your configuration and the
> possible matches that triggered it.

I mean that I still get this.

I tracked down the first problem to setopt glob_complete. i.e, the
following is sufficient to cause the problem:
zsh -f
ZLS_COLOURS=...;SELECTMIN=0;zmodload complist
autoload -U compinit;compinit -d
compconf urls_localhttp=...
setopt globcomplete

In the process, I established that _urls requires globcomplete; patch
follows.

With respect to the second problem, I think I was just confused by the
fact that I got a listing which looks like:
file
directory
fred/    joe
when I expected the file to appear before 'directory' so sorry for not
checking it before I sent the mail.

Tanaka Akira wrote:
> +++ Completion/User/_urls       1999/10/15 14:28:55
> @@ -1,4 +1,4 @@
> -#autoload
> +#compdef curl

Shouldn't this be done in _webbrowser. Or we should do what I suggested
before which is to ditch _webbrowser, add the programs to a compdef in
_urls and negate the meaning of -f to _urls.

> * Use [[ ... ]] instead of [ ... ].

Could someone please explain why [[ ... ]] seems to be prefered where
both forms provide the same functionality ? Sven also changed my use of
[ -d ... ] to use the double square brackets. Is it faster or something?

Oliver Kiddle

--- _urls.bak3	Fri Oct 15 16:11:03 1999
+++ _urls	Fri Oct 15 16:13:26 1999
@@ -37,6 +37,8 @@
 #    name used by a user placing web pages within their home area.
 #    e.g. compconf
urls_localhttp=www:/usr/local/apache/htdocs:public_html
 
+setopt localoptions extendedglob
+
 local ipre scheme host user dirs files ret=1 expl
 local localhttp_servername="${${(@s.:.)compconfig[urls_localhttp]}[1]}"
 local
localhttp_documentroot="${${(@s.:.)compconfig[urls_localhttp]}[2]}"


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
@ 1999-10-15 12:10 Sven Wischnowsky
  1999-10-15 15:30 ` Oliver Kiddle
  0 siblings, 1 reply; 12+ messages in thread
From: Sven Wischnowsky @ 1999-10-15 12:10 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> One strange behaviour I find with completing urls is that with
> urls_localhttpd set, when I complete user directories, menu
> selection is entered imediately rather than waiting for a second tab:
> e.g: netscape http://risc10/~<tab> will insert 'ada' and give me the
> list with 'ada' selected rather than just giving me the list. This
> behaviour continues when completing files and directories after the
> username. 
> 
> I've also noticed that with this dual file/directory completion and
> description_format set, I get 'file' aswell as 'directory' at the top
> of the list even if there were no files to complete. 

Do you mean to say that you still get this or that you fixed it? At
least I don't get either of these after your patch. If you still get
them, I need more information about your configuration and the
possible matches that triggered it.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1999-10-18  9:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-14 17:09 setopt localoptions noautoremoveslash Tanaka Akira
1999-10-14 17:15 ` Zefram
1999-10-14 18:08   ` Tanaka Akira
1999-10-15 11:24     ` PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Oliver Kiddle
1999-10-15 14:36       ` Tanaka Akira
1999-10-15  3:15   ` setopt localoptions noautoremoveslash Wayne Davison
1999-10-15 12:10 PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Sven Wischnowsky
1999-10-15 15:30 ` Oliver Kiddle
     [not found]   ` <991015155008.ZM24081@candle.brasslantern.com>
1999-10-15 16:05     ` Oliver Kiddle
1999-10-15 16:40       ` Bart Schaefer
1999-10-16 13:56   ` Tanaka Akira
1999-10-18  9:41 Sven Wischnowsky

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).