From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 8ff32c78 for ; Thu, 22 Aug 2019 06:38:44 +0000 (UTC) Received: (qmail 21290 invoked by alias); 22 Aug 2019 06:38:37 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44695 Received: (qmail 22620 invoked by uid 1010); 22 Aug 2019 06:38:37 -0000 X-Qmail-Scanner-Diagnostics: from hahler.de by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25545. spamassassin: 3.4.2. Clear:RC:0(188.40.33.212):SA:0(-1.7/5.0):. Processed in 2.244301 secs); 22 Aug 2019 06:38:37 -0000 X-Envelope-From: daniel@hahler.de X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.hahler.de designates 188.40.33.212 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received:received; s= postfix2; t=1566455879; bh=mt69h6/k3SXjzM8EBF5IWB8VNeOZ1W39LU1bJ UsQuRY=; b=uKOE14qxNdFBC3ZW3r7kYHRLsI9Ig+o/uCujlrBLY8geuGV34tSYx dYvLY+QW1FGZeeora/149e2WMPkh/qfWe0TppGtli27C4fFFxjvM3YFrqPHMCC8i 3bDOjV4xGDx2981PEifiAHgwtMPTLnHop9wpPujiF479upTpT1NQYw= From: Daniel Hahler To: zsh-workers@zsh.org Subject: [PATCH] _make: target: handle "make -C dir" Date: Thu, 22 Aug 2019 08:37:53 +0200 Message-Id: <20190822063753.25557-1-genml+zsh-workers@thequod.de> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmail-Scanner-2.11: added fake Content-Type header Content-Type: text/plain From: Daniel Hahler _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