<div dir="ltr"><div>Please apply the patch below for "make" completion.</div><div><br></div><div>It adds support for completing hidden targets when the user has partially completed it.</div><div><br></div><div>My previous trouble with the unit test is resolved - it is due to my support for display-mode completion which requires an extra option in the test case assertion:</div><div><br></div><div>   -expect-cmd-minus "."</div><div><br></div><div>---</div><div> completions/make              |  9 ++++++++-</div><div> test/fixtures/make/Makefile   | 16 ++++++++++++++++</div><div> test/lib/completions/make.exp | 28 ++++++++++++++++++++++++++++</div><div> 3 files changed, 52 insertions(+), 1 deletion(-)</div><div><br></div><div>diff --git a/completions/make b/completions/make</div><div>index 3f697be..e84e5ba 100644</div><div>--- a/completions/make</div><div>+++ b/completions/make</div><div>@@ -61,9 +61,16 @@ function _make_target_extract_script()</div><div>       /^\.POSIX:/                 d;            # special target</div><div>       /^\.NOEXPORT:/              d;            # special target</div><div>       /^\.MAKE:/                  d;            # special target</div><div>+EOF</div><div> </div><div>-      /^[^a-zA-Z0-9]/             d;            # convention for hidden tgt</div><div>+    # don't complete with hidden targets unless we are doing a partial completion</div><div>+    if [[ -z "${prefix_pat}" || "${prefix_pat}" = */ ]]; then</div><div>+      cat <<EOF</div><div>+      /^${prefix_pat}[^a-zA-Z0-9]/d             # convention for hidden tgt</div><div>+EOF</div><div>+    fi</div><div> </div><div>+    cat <<EOF</div><div>       h;                                        # hold target</div><div>       d;                                        # delete line</div><div>     }</div><div>diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile</div><div>index 1a59f21..3d1d5f3 100644</div><div>--- a/test/fixtures/make/Makefile</div><div>+++ b/test/fixtures/make/Makefile</div><div>@@ -20,6 +20,22 @@ install: all</div><div> clean:</div><div> <span class="" style="white-space:pre">  </span>-rm -f $(NAME)</div><div> </div><div>+.test_passes:</div><div>+<span class="" style="white-space:pre">      </span>./sample >/dev/null</div><div>+<span class="" style="white-space:pre">    </span>touch ^@</div><div>+</div><div>+.cache/.1:</div><div>+<span class="" style="white-space:pre">        </span>touch $@</div><div>+</div><div>+.cache/.2:</div><div>+<span class="" style="white-space:pre">        </span>touch $@</div><div>+</div><div>+.cache/1:</div><div>+<span class="" style="white-space:pre"> </span>touch $@</div><div>+</div><div>+.cache/2:</div><div>+<span class="" style="white-space:pre"> </span>touch $@</div><div>+</div><div> ifndef __BASH_MAKE_COMPLETION__</div><div> -include sample.d</div><div> endif</div><div>diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp</div><div>index 977485d..93a53db 100644</div><div>--- a/test/lib/completions/make.exp</div><div>+++ b/test/lib/completions/make.exp</div><div>@@ -28,6 +28,34 @@ assert_complete_dir $targets "make " $dir $test</div><div> sync_after_int</div><div> </div><div> </div><div>+set test "\"make .<TAB>\" should complete hidden targets"</div><div>+set dir $::srcdir/fixtures/make</div><div>+set targets ".test_passes .cache/"</div><div>+assert_complete_dir $targets "make ." $dir $test</div><div>+</div><div>+</div><div>+sync_after_int</div><div>+</div><div>+</div><div>+set test "\"make .cache/<TAB>\" should complete targets"</div><div>+set dir $::srcdir/fixtures/make</div><div>+set targets "1 2"</div><div>+assert_complete_dir $targets "make .cache/" $dir $test</div><div>+</div><div>+</div><div>+sync_after_int</div><div>+</div><div>+</div><div>+set test "\"make .cache/.<TAB>\" should complete hidden targets"</div><div>+set dir $::srcdir/fixtures/make</div><div>+set targets ".1 .2"</div><div>+assert_complete_dir $targets "make .cache/." $dir $test \</div><div>+<span class="" style="white-space:pre">    </span>-expect-cmd-minus "."</div><div>+</div><div>+</div><div>+sync_after_int</div><div>+</div><div>+</div><div> set test "\"make <TAB>\" should not show anything in directory without makefile"</div><div> set dir $::srcdir/fixtures/make/empty_dir</div><div> assert_complete_dir "" "make " $dir $test</div><div>-- </div><div>2.5.0</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 April 2015 at 00:41, Tristan Wibberley <span dir="ltr"><<a href="mailto:tristan.wibberley@gmail.com" target="_blank">tristan.wibberley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_extra">Resending with a useful subject line</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote">On 20 April 2015 at 13:00,  <span dir="ltr"><<a href="mailto:bash-completion-devel-request@lists.alioth.debian.org" target="_blank">bash-completion-devel-request@lists.alioth.debian.org</a>></span> wrote:</div><div class="gmail_quote"><br></div><div class="gmail_quote">[snipped digest mail]<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>Date: Sun, 19 Apr 2015 16:05:30 +0300<br>
From: Ville Skytt? <<a href="mailto:ville.skytta@iki.fi" target="_blank">ville.skytta@iki.fi</a>><br></span>Message-ID:<br>
        <<a href="mailto:CABr9L5ADihGZEx08Qp3OBhCuP0CPyuJ2yHUyMJ0Ze0U2%2BdN9tg@mail.gmail.com" target="_blank">CABr9L5ADihGZEx08Qp3OBhCuP0CPyuJ2yHUyMJ0Ze0U2+dN9tg@mail.gmail.com</a>><br></blockquote><span><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Sun, Apr 5, 2015 at 5:31 PM, Tristan Wibberley<br>
<<a href="mailto:tristan.wibberley@gmail.com" target="_blank">tristan.wibberley@gmail.com</a>> wrote:<br>
<br>
> Secondly, please would you have a look at the bundle and consider applying<br>
> it?.<br>
<br>
I started looking into it. For me this is the first time I've come<br>
across git bundles and I must say that for contributions like this I<br>
find the format-patch/send-email approach which is documented in our<br>
README *much* preferrable. Could you please follow that in the future?<br></blockquote><div><br></div></span><div>Certainly, it was also the first time I used git bundles so I thought I'd try it out. I didn't  know about the README's requirements because I first found the mailing list via google.</div><span><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Anyway, about the first commit. I looked into what make produces off<br>
the modified Makefile, but it did not add any whitespace to any "#<br>
Files" or "# Not a target" lines, but I do see more than one space in<br>
the "# File is an intermediate prerequisite" line.</blockquote><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Could you clarify<br>
what the two first modifications are for, i.e. do you have a case<br>
where make produces output that would require these adjustments?<br></blockquote><div><br></div></span><div>As I recall, nothing requires the modifications to the match for '# Files' and '# Not a target' except for good practice. Since the output in Ubuntu changed in way that nonobviously broke completion I thought that I would make the script robust to the wider class of format changes so that those features don't vanish - unnoticed - if somebody unifies the output of make. Ie, I applied the network rule based on this experience.</div><span><div>  </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
The variable patch seems innocent enough, I've applied it.<br></blockquote><div><br></div></span><div>Great, thanks.</div><div><br></div><div><br></div><div>Any thoughts on the problem with the test case for the hidden target completion?</div><div><br></div><div><br></div><div>Thanks</div><div>--</div><div>Tristan</div></div></div></div>
</div><br></div>
</blockquote></div><br></div></div>