* Problem with zip completion
@ 2001-10-17 14:47 Vincent Lefevre
2001-10-17 15:43 ` Bart Schaefer
[not found] ` <20011017111333.A32235@dman.com>
0 siblings, 2 replies; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-17 14:47 UTC (permalink / raw)
To: zsh-users
With the standard zip completion function (under zsh 4.0.2), when I type
zip blah.zip file[TAB]
filename completion works, but when I type
zip -r blah.zip file[TAB]
it doesn't work any longer. Does anyone have a better completion
function for zip?
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 14:47 Problem with zip completion Vincent Lefevre
@ 2001-10-17 15:43 ` Bart Schaefer
2001-10-17 16:22 ` Oliver Kiddle
[not found] ` <20011017111333.A32235@dman.com>
1 sibling, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-10-17 15:43 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
On Oct 17, 4:47pm, Vincent Lefevre wrote:
} Subject: Problem with zip completion
}
} With the standard zip completion function (under zsh 4.0.2), when I type
}
} zip blah.zip file[TAB]
}
} filename completion works, but when I type
}
} zip -r blah.zip file[TAB]
}
} it doesn't work any longer. Does anyone have a better completion
} function for zip?
Hm. Completion/Unix/Command/_zip thinks that -R is the option for
recursing into subdirectories, but zip 2.1 and 2.3 (as distributed
by RedHat) use -r, and 2.3 says -R is "PKZIP recursion." Also, the
_zip function thinks `zip -e' will encrypt, but zip 2.3 doesn't have
that option on my system.
Oliver, it looks like you wrote the _zip function, posted in 13600.
On which version of zip did you base it?
Meanwhile, Vincent, as a temporary fix, edit _zip and replace -R with
-r in what should be the obvious place near the top of the function.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
[not found] ` <20011017111333.A32235@dman.com>
@ 2001-10-17 16:21 ` Vincent Lefevre
2001-10-17 16:49 ` Bart Schaefer
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-17 16:21 UTC (permalink / raw)
To: zsh-users
[back to zsh-users]
Thanks for the patch. But when I try to use patch, I get the following:
greux:~/software/zsh-4.0.2> patch < ../zsh-zip-patch <18:09:13
can't find file to patch at input line 8
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: Completion/Unix/Command/_zip
|===================================================================
|RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_zip,v
|retrieving revision 1.2
|diff -u -r1.2 _zip
|--- Completion/Unix/Command/_zip 2001/08/14 16:23:42 1.2
|+++ Completion/Unix/Command/_zip 2001/10/17 15:12:15
--------------------------
File to patch:
and I have to give the filename. Why couldn't patch find it?
What option should I use (the -p<num> options don't do anything)?
Moreover, why did I need to delete the .zcompdump file? Otherwise,
I had the following errors when execing zsh:
/users/spaces/lefevre/.zcompdump:487: command not found: ^[]1
/users/spaces/lefevre/.zcompdump:487: command not found: greux:~^G^[]2
/users/spaces/lefevre/.zcompdump:487: bad pattern: [1
This may come from:
precmd()
{
psvar[1]=$#jobstates;
if [[ $psvar[1] -eq 0 ]] then
psvar[1]=()
elif [[ $psvar[1] -eq 1 ]] then
psvar[1]="$psvar[1] job"
else
psvar[1]="$psvar[1] jobs"
fi
# Note: STY is set by screen
if [[ $TERM == (xterm*|dtterm|rxvt) && -z $STY ]] then
print -nP "\e]1;%m:%.\x07"
print -nP "\e]2;%(1v. [%1v] .)${WINTITLE:+ [$WINTITLE]} %n@%m - %~ \x07"
fi
}
In .zcompdump:
[...]
_compautos=(
_call_program +X
)
ESC]1;greux:~^GESC]2; [1 job] lefevre@greux - ~ ^Gzle -C _bash_complete-word .complete-word _bash_completions
zle -C _bash_list-choices .list-choices _bash_completions
zle -C _complete_debug .complete-word _complete_debug
zle -C _complete_help .complete-word _complete_help
zle -C _complete_tag .complete-word _complete_tag
zle -C _correct_filename .complete-word _correct_filename
zle -C _correct_word .complete-word _correct_word
zle -C _expand_alias .complete-word _expand_alias
zle -C _expand_word .complete-word _expand_word
zle -C _history-complete-newer .complete-word _history_complete_word
zle -C _history-complete-older .complete-word _history_complete_word
zle -C _list_expansions .list-choices _expand_word
zle -C _most_recent_file .complete-word _most_recent_file
zle -C _next_tags .complete-word _next_tags
zle -C _read_comp .complete-word _read_comp
ESC]1;greux:~^GESC]2; [1 job] lefevre@greux - ~ ^Gbindkey '^X^R' _read_comp
bindkey '^X?' _complete_debug
bindkey '^XC' _correct_filename
[...]
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 15:43 ` Bart Schaefer
@ 2001-10-17 16:22 ` Oliver Kiddle
0 siblings, 0 replies; 13+ messages in thread
From: Oliver Kiddle @ 2001-10-17 16:22 UTC (permalink / raw)
To: zsh-users; +Cc: Vincent Lefevre
Bart Schaefer wrote:
>
> Also, the
> _zip function thinks `zip -e' will encrypt, but zip 2.3 doesn't have
> that option on my system.
I'm fairly certain that for encryption, you need to download some
separate patches from a different server which depends on whether you're
in the US or not. I went to the trouble of doing that when I compiled it
on IRIX several years ago. It may have all changed by now though.
> Oliver, it looks like you wrote the _zip function, posted in 13600.
> On which version of zip did you base it?
I always get the latest before writing these so I will have had 2.3. I
know in this case that I looked at several other versions for reference.
I also remember there being more than a few differences between versions
and I may have left something out either intentionally or accidentally.
I suggest Clint's patch is applied for now but I'll go back and look at
_zip in detail again sometime soon incase there are other omissions.
Oliver
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 16:21 ` Vincent Lefevre
@ 2001-10-17 16:49 ` Bart Schaefer
2001-10-17 17:11 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-10-17 16:49 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
On Oct 17, 6:21pm, Vincent Lefevre wrote:
}
} Why couldn't patch find it?
} What option should I use (the -p<num> options don't do anything)?
You probably needed -p0 to tell it not to strip off any path components
at all.
} Moreover, why did I need to delete the .zcompdump file?
That one I can't tell you. It sure looks like you got some stray output
written into the .zcompdump file. Do you perhaps have a preexec that
emits something to stdout? Unlike precmd, which executes only when a
prompt is printed, preexec executes before *every* top-level command,
even when running shell scripts.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 16:49 ` Bart Schaefer
@ 2001-10-17 17:11 ` Vincent Lefevre
2001-10-17 17:24 ` Bart Schaefer
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-17 17:11 UTC (permalink / raw)
To: zsh-users
On Wed, Oct 17, 2001 at 16:49:32 +0000, Bart Schaefer wrote:
> You probably needed -p0 to tell it not to strip off any path components
> at all.
Hmm... yes, I forgot that one. A bit tired... :( Thanks.
> That one I can't tell you. It sure looks like you got some stray output
> written into the .zcompdump file. Do you perhaps have a preexec that
> emits something to stdout? Unlike precmd, which executes only when a
> prompt is printed, preexec executes before *every* top-level command,
> even when running shell scripts.
No, I have no preexec function. These lines come from the precmd
function. I also have:
TRAPCLD() { precmd }
If I replace it by
TRAPCLD() { precmd > $TTY }
this solves the problem. Is it the right thing to do?
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 17:11 ` Vincent Lefevre
@ 2001-10-17 17:24 ` Bart Schaefer
2001-10-17 17:44 ` Bart Schaefer
0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-10-17 17:24 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
On Oct 17, 7:11pm, Vincent Lefevre wrote:
}
} If I replace it by
}
} TRAPCLD() { precmd > $TTY }
}
} this solves the problem. Is it the right thing to do?
Almost certainly.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 17:24 ` Bart Schaefer
@ 2001-10-17 17:44 ` Bart Schaefer
2001-10-17 23:15 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-10-17 17:44 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
On Oct 17, 5:24pm, Bart Schaefer wrote:
}
} On Oct 17, 7:11pm, Vincent Lefevre wrote:
} }
} } TRAPCLD() { precmd > $TTY }
} }
} } this solves the problem. Is it the right thing to do?
}
} Almost certainly.
Actually, having given it a moment's more thought, it would probably be
better to use
TRAPCLD() { [[ -t 0 ]] && precmd }
or even
TRAPCLD() { [[ -o interactive && -t 0 ]] && precmd }
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 17:44 ` Bart Schaefer
@ 2001-10-17 23:15 ` Vincent Lefevre
2001-10-18 0:57 ` Bart Schaefer
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-17 23:15 UTC (permalink / raw)
To: zsh-users
On Wed, Oct 17, 2001 at 17:44:46 +0000, Bart Schaefer wrote:
> Actually, having given it a moment's more thought, it would probably be
> better to use
>
> TRAPCLD() { [[ -t 0 ]] && precmd }
>
> or even
>
> TRAPCLD() { [[ -o interactive && -t 0 ]] && precmd }
Why? If TRAPCLD is called when stdout is redirected (thus, not necessarily
attached to a tty), I still want to be able to write to the tty (here, to
change the terminal title).
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-17 23:15 ` Vincent Lefevre
@ 2001-10-18 0:57 ` Bart Schaefer
2001-10-18 2:13 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2001-10-18 0:57 UTC (permalink / raw)
To: Vincent Lefevre, zsh-users
On Oct 18, 1:15am, Vincent Lefevre wrote:
> Subject: Re: Problem with zip completion
> On Wed, Oct 17, 2001 at 17:44:46 +0000, Bart Schaefer wrote:
> > Actually, having given it a moment's more thought, it would probably be
> > better to use
> >
> > TRAPCLD() { [[ -t 0 ]] && precmd }
> >
> > or even
> >
> > TRAPCLD() { [[ -o interactive && -t 0 ]] && precmd }
>
> Why? If TRAPCLD is called when stdout is redirected (thus, not necessarily
> attached to a tty), I still want to be able to write to the tty (here, to
> change the terminal title).
It depends on where and how you're defining the TRAPCLD function, I guess.
My assumption would be that if stdout is redirected, then the child that's
exiting must not be a child of the top-level interactive shell, and thus
changing the terminal title would at best be a waste of effort.
Remember, it's the stdout of the *parent* of the exiting job that we're
testing here.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-18 0:57 ` Bart Schaefer
@ 2001-10-18 2:13 ` Vincent Lefevre
2001-10-18 4:46 ` Sweth Chandramouli
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-18 2:13 UTC (permalink / raw)
To: zsh-users
On Wed, Oct 17, 2001 at 17:57:57 -0700, Bart Schaefer wrote:
> My assumption would be that if stdout is redirected, then the child that's
> exiting must not be a child of the top-level interactive shell, and thus
> changing the terminal title would at best be a waste of effort.
Well, maybe. I thought that stdout (of the top-level shell) could be
temporarily redirected with some obscure builtins I didn't know.
Now, I've chosen: TRAPCLD() { [[ -o interactive && -t 0 ]] && precmd }
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-18 2:13 ` Vincent Lefevre
@ 2001-10-18 4:46 ` Sweth Chandramouli
2001-10-18 9:05 ` Vincent Lefevre
0 siblings, 1 reply; 13+ messages in thread
From: Sweth Chandramouli @ 2001-10-18 4:46 UTC (permalink / raw)
To: zsh-users
On Thu, Oct 18, 2001 at 04:13:55AM +0200, Vincent Lefevre wrote:
> On Wed, Oct 17, 2001 at 17:57:57 -0700, Bart Schaefer wrote:
> > My assumption would be that if stdout is redirected, then the child that's
> > exiting must not be a child of the top-level interactive shell, and thus
> > changing the terminal title would at best be a waste of effort.
>
> Well, maybe. I thought that stdout (of the top-level shell) could be
> temporarily redirected with some obscure builtins I didn't know.
No need for obscure builtins; standard redirection can
always be applied to the current shell via exec:
$ exec > /tmp/file
$ ls
$ exec > /dev/tty
$ ls
file1 file2 file3
$ cat /tmp/file
file1
file2
file3
. I'm not sure why you'd want to do that in an interactive
shell, though.
-- Sweth.
--
Sweth Chandramouli ; <svc@idiopathic.net>
President, Idiopathic Systems Consulting
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Problem with zip completion
2001-10-18 4:46 ` Sweth Chandramouli
@ 2001-10-18 9:05 ` Vincent Lefevre
0 siblings, 0 replies; 13+ messages in thread
From: Vincent Lefevre @ 2001-10-18 9:05 UTC (permalink / raw)
To: zsh-users
On Thu, Oct 18, 2001 at 00:46:59 -0400, Sweth Chandramouli wrote:
> . I'm not sure why you'd want to do that in an interactive
> shell, though.
Perhaps to have something like that, to write information about the
current shell to a file?
testfct () {
exec >| /tmp/file
echo "setopt:"
setopt
echo "unsetopt:"
unsetopt
echo "jobs:"
jobs
exec > /dev/tty
}
I think I'll take
TRAPCLD () { [[ -o interactive && -n $TTY ]] && precmd > $TTY }
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2001-10-18 9:06 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-17 14:47 Problem with zip completion Vincent Lefevre
2001-10-17 15:43 ` Bart Schaefer
2001-10-17 16:22 ` Oliver Kiddle
[not found] ` <20011017111333.A32235@dman.com>
2001-10-17 16:21 ` Vincent Lefevre
2001-10-17 16:49 ` Bart Schaefer
2001-10-17 17:11 ` Vincent Lefevre
2001-10-17 17:24 ` Bart Schaefer
2001-10-17 17:44 ` Bart Schaefer
2001-10-17 23:15 ` Vincent Lefevre
2001-10-18 0:57 ` Bart Schaefer
2001-10-18 2:13 ` Vincent Lefevre
2001-10-18 4:46 ` Sweth Chandramouli
2001-10-18 9:05 ` Vincent Lefevre
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).