From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list),
Matt Armstrong <matt@corp.phone.com>
Subject: Re: (forw) --help able programs and completion
Date: Mon, 26 Jun 2000 17:01:48 +0100 [thread overview]
Message-ID: <0FWR004K0R6ZW8@la-la.cambridgesiliconradio.com> (raw)
In-Reply-To: "Your message of Mon, 26 Jun 2000 08:30:00 PDT." <20000626083000.A22758@corp.phone.com>
> My .zshrc is a symbolic link to ~/dotfiles/zshrc. compinstall got
> confused by this and replaced the entire contents with its own stuff.
>
> Perhaps it could check for a symlink and reference ~/dotfiles/zshrc
> directly?
I think there were two things: it would follow the symlink OK, but it would
save the file as a real file in place of the symlink, which I've fixed.
Also, it didn't append like it was supposed to.
> Anyway, I was confused by this interaction -- especially the line:
>
> This will be written to the new file .
There were some poor tests on the variable.
> (it'd be nice if compinstall would offer to append definitions to the
> given file).
Ouch, it should automatically append the lines rather than replace the
file.
Index: Completion/Core/compinstall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/compinstall,v
retrieving revision 1.14
diff -u -r1.14 compinstall
--- Completion/Core/compinstall 2000/05/22 17:52:52 1.14
+++ Completion/Core/compinstall 2000/06/26 15:58:30
@@ -35,7 +35,7 @@
#
# This relies on the stuff we find being only minimally edited from
# the stuff we originally saved. A better way of doing this would
-# almost certianly be to use the style mechanism directly: save the
+# almost certainly be to use the style mechanism directly: save the
# current styles in a variable, delete all styles, read in and evaluate
# any styles found, manipulate styles directly using zstyle, write out
# using zstyle -L, and if necessary restore the original styles. One
@@ -147,17 +147,19 @@
print "All the comments in your configuration section will be lost.
If you want to keep them, you should copy them somewhere else first."
elif (( ! $lines_found )); then
- print -n "Starting a new completion configuration from scratch.
-This will be "
- if [[ ! -f $ifile ]]; then
- print "written to the new file $ifile."
- elif [[ ! -w $ifile ]]; then
- print "written to the file ~/.compinstall for copying to $ifile."
- ifile=$HOME/.compinstall
- else
- print "appended to the file $ifile. It is up to you to ensure
+ print "Starting a new completion configuration from scratch."
+ if [[ -n $ifile && ! -d $ifile ]]; then
+ print -n "This will be "
+ if [[ ! -f $ifile ]]; then
+ print "written to the new file $ifile."
+ elif [[ ! -w $ifile ]]; then
+ print "written to the file ~/.compinstall for copying to $ifile."
+ ifile=$HOME/.compinstall
+ else
+ print "appended to the file $ifile. It is up to you to ensure
that these lines are actually executed. They will not be if your .zshrc
usually returns before the end."
+ fi
fi
fi
print "Note that you will be given a chance to save the new setup
@@ -1711,8 +1713,9 @@
done
fi
-if ! read -q key"?Save new settings to $ifile? "; then
- print "Enter a different filename (~ will be expanded), or return to abort:"
+if [[ -z $ifile || -d $ifile ]] ||
+ ! read -q key"?Save new settings to $ifile? "; then
+ print "Enter file to save in (~ will be expanded), or return to abort:"
ifile=
vared -ch -p 'file> ' ifile
ifile=${~ifile}
@@ -1759,8 +1762,8 @@
if { { grep "$endline" $ifile >/dev/null 2>&1 &&
sed -e "/^[ ]*$endline/r $tmpout
/^[ ]*$startline/,/^[ ]*$endline/d" $ifile >${tmpout}2 } ||
- cat $tmpout >>${tmpout}2 } &&
- mv ${tmpout}2 $ifile; then
+ { cp $ifile ${tmpout}2 && cat $tmpout >>${tmpout}2 } } &&
+ cp ${tmpout}2 $ifile && rm -f ${tmpout}2; then
print "\nSuccessfully added compinstall lines to $ifile."
rm -f $tmpout
else
--
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
parent reply other threads:[~2000-06-26 16:02 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20000626083000.A22758@corp.phone.com>]
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=0FWR004K0R6ZW8@la-la.cambridgesiliconradio.com \
--to=pws@cambridgesiliconradio.com \
--cc=matt@corp.phone.com \
--cc=zsh-workers@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).