zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: Re: Completion troubles
Date: Mon, 1 May 2000 17:45:27 +0000	[thread overview]
Message-ID: <1000501174527.ZM12695@candle.brasslantern.com> (raw)
In-Reply-To: <390DAF22.A11AFB7B@u.genie.co.uk>

On May 1,  5:21pm, Oliver Kiddle wrote:
} Subject: Completion troubles
}
} I've had a couple of problems with the latest zsh:
} 
} nedit -lm <tab>
} Gives me a message about _all_labels:39: command not found: -M

I get an error message about ~/.nedit not being found.  I don't have
to have a .nedit to run nedit, do I?

} I can't see where this might be a problem anywhere in _nedit. I can
} reproduce it from a basic zsh -f based setup (although it complains
} about -J instead).

Use _complete_debug, ^X?, and examine the trace file.  You should see
a line similar to this (I have PS4='+%1N:%i%1(_.:%_.): ') somewhere:

+_wanted:23:while: _all_labels -J neditlanguages expl language mode compadd - 

(with the list of languages following the "_").  _all_labels expects the
command to run to be $4 ("compadd" above, "language mode" is $3).  I have
a suspicion that you're getting the wrong version of _nedit somehow, but
I can't be sure.

} The other thing is the _expand completer now seems to be expanding
} everything after a tilde which is annoying.

Hmm, that doesn't happen to me;  I get this sort of thing:

zagzig[76] ls ~-<TAB>
Completing directory stack
0 -- /usr/src/local/zsh/zsh-forge/current
1 -- /usr/src/local/zsh/zsh-3.1.6

If there is no directory stack, then it immediately inserts `0/' and
goes on completing.

} I think _expand really needs a rethink because it is more
} trouble than it is worth at the moment. For example, if you do:
} cd ${foo<tab>
} you get a message about a closing brace being expected

That one also works for me.  I think you must have the `substitute' style
set to a true value.  However, we can fix the problem with the closing
brace; that happens because a missing close-brace is a parse error that
aborts the entire function.  The workaround is to force that parse error
into a subshell; unpleasant, but nothing else will do.  (Ick, those kind
of aborts do very unpleasant things to _complete_debug, leaving stderr
pointing into the completion trace file.  I can't think of a fix, though.)

Index: Completion/Core/_expand
===================================================================
@@ -32,13 +32,14 @@
 exp=("$word")
 
 # First try substitution. That weird thing spanning multiple lines
-# changes quoted spaces, tabs, and newlines into spaces.
+# changes quoted spaces, tabs, and newlines into spaces and protects
+# this function from aborting on parse errors in the expansion.
 
 { zstyle -s ":completion:${curcontext}:" substitute expr ||
   { [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
     [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
-    exp=( "${(e)exp//\\[ 	
-]/ }" )
+    exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
+]/ } 2>/dev/null)"} )
 
 # If the array is empty, store the original string again.
 
Index: Completion/User/_nedit
===================================================================
@@ -44,7 +44,7 @@
     "$nedit_common[@]"
 fi
 
-[[ $state = lang ]] &&
+[[ $state = lang && -f ~/.nedit ]] &&
     _wanted neditlanguages expl 'language mode' \
         compadd -  ${(f)"$(sed -n \
             '/^nedit.languageMode/,/^nedit/ s/.*	\([^:]*\).*/\1/p' < ~/.nedit)"}

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


      reply	other threads:[~2000-05-01 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-01 16:21 Oliver Kiddle
2000-05-01 17:45 ` 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=1000501174527.ZM12695@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.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).