zsh-workers
 help / color / mirror / code / Atom feed
* New "make" completion (Attempt 3)
@ 2009-11-23 23:50 Michael Hwang
  2009-11-24 10:11 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Hwang @ 2009-11-23 23:50 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

Sorry, I guess Yahoo is nuking my attachments. Just in case, there's
an attachment on this e-mail, as well as a paste.

http://pastebin.com/m3800c08b

Michael Hwang

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

* Re: New "make" completion (Attempt 3)
  2009-11-23 23:50 New "make" completion (Attempt 3) Michael Hwang
@ 2009-11-24 10:11 ` Peter Stephenson
  2009-11-24 10:37   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2009-11-24 10:11 UTC (permalink / raw)
  To: zsh-workers

Michael Hwang wrote:
> --0016e6d58b2f9031690479127c3d
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Sorry, I guess Yahoo is nuking my attachments. Just in case, there's
> an attachment on this e-mail, as well as a paste.
> 
> http://pastebin.com/m3800c08b

At the risk of rubbing it in, that wasn't completely ideal either:  a
URL that points to the raw file is better.

I've committed this---it certain looks like it does a better job after a
brief test.

This:

  # These are left over from the old completion. I'm not sure what they do.
  #compstate[parameter]="${PREFIX%%\=*}"
  #compset -P 1 '*='
  #_value "$@"

was an attempt to complete tha value of a variable, using the usual
context of parameter completion.  By default you'd be able to complete
files, which was quite useful.  I'll commit the following, as well
as fixing the indentation back to two spaces:

Index: Completion/Unix/Command/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_make,v
retrieving revision 1.21
diff -u -r1.21 _make
--- Completion/Unix/Command/_make	24 Nov 2009 10:01:11 -0000	1.21
+++ Completion/Unix/Command/_make	24 Nov 2009 10:08:53 -0000
@@ -197,7 +197,10 @@
 
 	if [[ $PREFIX == (#b)([^=]##)'='* ]] && [[ -n ${${(k)VARIABLES}[(r)${match[1]}]} ]]
 	then
-		_message 'override make variable'
+	        # Complete make variable as if shell variable
+		compstate[parameter]="${PREFIX%%\=*}"
+		compset -P 1 '*='
+		_value "$@"
 	else
 		_tags targets variables
 		while _tags
@@ -208,9 +211,4 @@
 				compadd -S '=' -- ${(k)VARIABLES}
 		done
 	fi
-
-	# These are left over from the old completion. I'm not sure what they do.
-	#compstate[parameter]="${PREFIX%%\=*}"
-	#compset -P 1 '*='
-	#_value "$@"
 fi


-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


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

* Re: New "make" completion (Attempt 3)
  2009-11-24 10:11 ` Peter Stephenson
@ 2009-11-24 10:37   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2009-11-24 10:37 UTC (permalink / raw)
  To: zsh-workers

On Tue, 24 Nov 2009 10:11:25 +0000
Peter Stephenson <pws@csr.com> wrote:
> This:
> 
>   # These are left over from the old completion. I'm not sure what they do.
>   #compstate[parameter]="${PREFIX%%\=*}"
>   #compset -P 1 '*='
>   #_value "$@"
> 
> was an attempt to complete the value of a variable, using the usual
> context of parameter completion.  By default you'd be able to complete
> files, which was quite useful.  I'll commit the following, as well
> as fixing the indentation back to two spaces:

On second thoughts, I don't see any point in restricting the completion of
values to variables already mentioned in the Makefile; what about PATH, for
example?  As far as I know, make syntax is explicit that <var>= is always
parsed as an assignment, so there's no gain in dropping through to the
other branch.

Index: Completion/Unix/Command/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_make,v
retrieving revision 1.22
diff -u -r1.22 _make
--- Completion/Unix/Command/_make	24 Nov 2009 10:14:33 -0000	1.22
+++ Completion/Unix/Command/_make	24 Nov 2009 10:33:40 -0000
@@ -197,7 +197,7 @@
     fi
   fi
 
-  if [[ $PREFIX == (#b)([^=]##)'='* ]] && [[ -n ${${(k)VARIABLES}[(r)${match[1]}]} ]]
+  if [[ $PREFIX == *'='* ]]
   then
     # Complete make variable as if shell variable
     compstate[parameter]="${PREFIX%%\=*}"

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


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

end of thread, other threads:[~2009-11-24 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-23 23:50 New "make" completion (Attempt 3) Michael Hwang
2009-11-24 10:11 ` Peter Stephenson
2009-11-24 10:37   ` Peter Stephenson

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