zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Rpm completion problem
Date: Tue, 8 Aug 2000 14:07:46 +0200 (MET DST)	[thread overview]
Message-ID: <200008081207.OAA07190@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Sun, 6 Aug 2000 19:08:41 +0000


Bart Schaefer wrote:

> On Aug 5,  5:08pm, Bart Schaefer wrote:
> }
> } On Aug 5, 12:25am, Wayne Davison wrote:
> } }
> } } I've noticed a problem in rpm completions when I specify the 'p'
> } } (package file) option bunched up with other options.
> } 
> } This was discussed in the thread referenced by zsh-workers/11752, and
> } I think the patch in 11985 was supposed to provide a way to fix it, but
> } _rpm never got updated.
> 
> The last word in that discussion appears to have been   Sven, do you
> recall whether you every did anything specific to this?

The patch is in 11876. I didn't touch _rpm, though (as you saw).

> I remarked in 11742:
> 
> } Currently _rpm uses `-p+' as the spec for the -p option.  That means that
> } anything that will follow the -p (including package file name) is allowed
> } to appear in the same word, or in the next word.
> } 
> } If we remove the `+', then "rpm -qpc" doesn't match the spec `-p', and so
> } completion doesn't enter the `package_file' state -- it instead enters the
> } `package_or_file' state (the default spec from the `query' state).
> 
> This is no longer the problem; remove the `+' and `rpm -qpc <TAB>' completes
> package file names exactly as it should.  However, `rpm -qp<TAB>' inserts a
> space rather than completing `c' et al.
> 
> Based on my exchange with Sven as quoted in 11793, I'd say that _rpm needs
> another ->state in order to handle bunched query options following -qp, or
> at least that the package_file state needs to be tweaked somehow.  In the
> meantime, if you don't mind having to make `p' be the last option in any
> bunch beginning with `-q', just remove the `+' on line 62 of _rpm.

There were to buglets. ca_get_sopt() (the function that checks if we
are in a multi-single-letter-option string) returned the wrong option,
namely the `i' in `-qip'. And then we should handle the option
argument in the same word only if we have a `-o+' option.

As far as I can see, it should work correctly now. Or does rpm accept
a filename directly after the -p in the same word? In that we have to
put back the `+' in _rpm.

Bye
 Sven

Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.16
diff -u -r1.16 _rpm
--- Completion/Linux/_rpm	2000/08/02 13:45:52	1.16
+++ Completion/Linux/_rpm	2000/08/08 12:02:29
@@ -59,7 +59,7 @@
   )
   packageopts=(
     '-a[query all packages]'
-    '-p+[query uninstalled package file]:*:RPM package file:->package_file'
+    '-p[query uninstalled package file]:*:RPM package file:->package_file'
     '-f[specify file to query owner of]:file:_files'
     '--triggeredby:RPM package:->package'
     '--whatprovides:RPM capability:->capability'
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.40
diff -u -r1.40 computil.c
--- Src/Zle/computil.c	2000/08/08 10:32:49	1.40
+++ Src/Zle/computil.c	2000/08/08 12:02:38
@@ -1108,6 +1108,7 @@
 			line++;
 		    *end = line;
 		}
+		pp = p;
 		break;
 	    }
 	} else if (!p || (p && !p->active))
@@ -1429,7 +1430,9 @@
 	    if (!state.oargs[state.curopt->num])
 		state.oargs[state.curopt->num] = znewlinklist();
 
-	    ddef = state.def = state.curopt->args;
+	    state.def = state.curopt->args;
+	    ddef = (state.curopt->type == CAO_NEXT && cur == compcurrent ?
+		    NULL : state.def);
 	    dopt = state.curopt;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;

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


             reply	other threads:[~2000-08-08 12:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-08 12:07 Sven Wischnowsky [this message]
2000-08-08 15:43 ` Bart Schaefer

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=200008081207.OAA07190@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).