zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _make: target: handle "make -C dir"
@ 2019-08-22  6:37 Daniel Hahler
  2019-08-23  4:48 ` Daniel Shahaf
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Hahler @ 2019-08-22  6:37 UTC (permalink / raw)
  To: zsh-workers

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


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

end of thread, other threads:[~2019-08-24 18:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  6:37 [PATCH] _make: target: handle "make -C dir" Daniel Hahler
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

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