git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Vegard Nossum <vegard.nossum@oracle.com>
Subject: Re: [PATCH 6/6] grep: show non-empty lines before functions with -W
Date: Tue, 21 Nov 2017 15:35:34 -0800	[thread overview]
Message-ID: <CAGZ79kbL-oXPTgB+tzAUEVJ7K=F44883bW1u93UYgp4kp8r=fA@mail.gmail.com> (raw)
In-Reply-To: <55af5442-c22a-342e-edbd-02a776228345@web.de>

On Mon, Nov 20, 2017 at 2:07 PM, René Scharfe <l.s.r@web.de> wrote:
> Am 20.11.2017 um 21:39 schrieb Stefan Beller:
>> On Sat, Nov 18, 2017 at 10:08 AM, René Scharfe <l.s.r@web.de> wrote:
>>> Non-empty lines before a function definition are most likely comments
>>> for that function and thus relevant.  Include them in function context.
>>>
>>> Such a non-empty line might also belong to the preceding function if
>>> there is no separating blank line.  Stop extending the context upwards
>>> also at the next function line to make sure only one extra function body
>>> is shown at most.
>>
>> Can we add another heuristic, that checks for common function body ends, e.g.
>> if the preceding line contains '}' but is not commented (the line doesn't
>> contain '*/' '//', '#'), we have a strong hint that it is a function, not an
>> additional comment.
>
> C comments containing "}" as part of the text would only be shown
> partially, e.g:
>
>         /*
>          * Not shown because of the curly closing brace in ${PATH}.
>          * Shown.
>          */
>
> Two examples in git's repo are in refs.h and sha1-lookup.c.
>
> Before diving deeper: Is it worth it?  Does the heuristic in this series
> produce excessive context often?  Enough to be annoying?

We'll find out... I was just spurting out my thought of the day.
Sorry for the noise.

      reply	other threads:[~2017-11-21 23:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-18 18:01 [PATCH 0/6] show non-empty lines before functions with diff/grep -W René Scharfe
2017-11-18 18:04 ` [PATCH 1/6] t4051: add test for comments preceding function lines René Scharfe
2017-11-19  1:18   ` Eric Sunshine
2017-11-19 10:02     ` René Scharfe
2017-11-20  0:36       ` Junio C Hamano
2017-11-20 17:28         ` René Scharfe
2017-11-21  0:37           ` Junio C Hamano
2017-11-18 18:04 ` [PATCH 2/6] xdiff: factor out is_func_rec() René Scharfe
2017-11-18 18:05 ` [PATCH 3/6] xdiff: show non-empty lines before functions with -W René Scharfe
2017-11-18 18:06 ` [PATCH 4/6] t7810: improve check of -W with user-defined function lines René Scharfe
2017-11-18 18:07 ` [PATCH 5/6] grep: update boundary variable for pre-context René Scharfe
2017-11-18 18:08 ` [PATCH 6/6] grep: show non-empty lines before functions with -W René Scharfe
2017-11-20 20:39   ` Stefan Beller
2017-11-20 22:07     ` René Scharfe
2017-11-21 23:35       ` Stefan Beller [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kbL-oXPTgB+tzAUEVJ7K=F44883bW1u93UYgp4kp8r=fA@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=vegard.nossum@oracle.com \
    /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://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).