Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#262247: zsh: Improved make completion



Hi Wayne.

* Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx> [2004-08-21 11:09-0700]
> On Wed, Aug 18, 2004 at 11:07:36AM -0400, Hugo Haas wrote:
> > Attached is an attempt at doing this. It seems to work, though I only
> > enabled it for the gnu case.
> 
> I tried your patch, and it ignored targets that had dependencies (since
> it only matched a colon at the end of the line).

Oh, that's right…

> Here's my attempt at a zsh-only verson of _make.  It not only
> follows include files, but it expands variables too.

It's pretty cool. I found an issue with the code though, which I don't
know how to work around: variable names are different in make and zsh.

In make:

  A variable name may be any sequence of characters not containing
  `:', `#', `=', or leading or trailing whitespace.

In zsh:

  A name may be any sequence of alphanumeric characters and
  underscores, or  the single  characters ‘*’, ‘@’, ‘#’, ‘?’, ‘-’,
  ‘$’, or ‘!’.

I guess that it's not a big deal: there will be cases where variables
won't be expanded, and certain rules will be missing, but it's better
than the previous code which didn't look at variables at all.

Also, the make documentation says:

  However, variable names containing characters other than letters,
  numbers, and underscores should be avoided, as they may be given
  special meanings in the future, and with some shells they cannot be
  passed through the environment to a sub-`make' (*note Communicating
  Variables to a Sub-`make': Variables/Recursion.).

Therefore, it's recommended to use cases which are actually going to
work with your code. So I think it's fine.

> I tried to make it handle both gnu and non-gnu include files, but I
> assume that the ".include <...>" form needs more code to handle
> where the include really resides.
> 
> Since the patch was larger than the new _make script, I'm just attaching
> the new _make script here.  Give it a try and see how you like it.

I think it's a great improvement on the current _make script, and
would be happy to see it included in zsh.

Regards,

Hugo

-- 
Hugo Haas - http://larve.net/people/hugo/

Attachment: signature.asc
Description: Digital signature



Messages sorted by: Reverse Date, Date, Thread, Author