zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Subject: [PATCH] _make: target: handle "make -C dir"
Date: Thu, 22 Aug 2019 08:37:53 +0200	[thread overview]
Message-ID: <20190822063753.25557-1-genml+zsh-workers@thequod.de> (raw)

From: Daniel Hahler <git@thequod.de>

_make-findBasedir handles any "-C" arguments to find the basedir, but
with `zstyle -t :completion::complete:make::targets call-command true`
it would then not use it.

This is necessary however to get the correct list of targets, which
might be generated based on files from there.

`$basedir` defaults to `$PWD`, so it is ok to pass it always (I assume).
---
 Completion/Unix/Command/_make | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index e23906373..38d0b0e76 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -236,13 +236,13 @@ _make() {
 
     (target)
     file=${(v)opt_args[(I)(-f|--file|--makefile)]}
+    local basedir
+    basedir=${$(_make-findBasedir $words)}
     if [[ -n $file ]]
     then
-      [[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
+      [[ $file == [^/]* ]] && file=$basedir/$file
       [[ -r $file ]] || file=
     else
-      local basedir
-      basedir=${$(_make-findBasedir $words)}
       if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]]
       then
         file=$basedir/GNUmakefile
@@ -259,10 +259,10 @@ _make() {
 
     if [[ -n "$file" ]]
     then
-      if [[ $is_gnu == gnu ]] 
+      if [[ $is_gnu == gnu ]]
       then
         if zstyle -t ":completion:${curcontext}:targets" call-command; then
-          _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+          _make-parseMakefile < <(_call_program targets "$words[1]" -C $basedir -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
         else
           _make-parseMakefile < $file
         fi
-- 
2.23.0


             reply	other threads:[~2019-08-22  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  6:37 Daniel Hahler [this message]
2019-08-23  4:48 ` Daniel Shahaf
2019-08-23 10:40   ` Mikael Magnusson
2019-08-24 16:41     ` Daniel Shahaf
2019-08-24 18:49       ` Mikael Magnusson

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=20190822063753.25557-1-genml+zsh-workers@thequod.de \
    --to=genml+zsh-workers@thequod.de \
    --cc=zsh-workers@zsh.org \
    /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).