git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] grep: long context options

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Aug 2, 2011, 17:24 UTC
Message-ID
<4E3832B1.1030408@lsrfire.ath.cx>
In-Reply-To
<20110802010143.GL13795@ece.pdx.edu>
Am 02.08.2011 03:01, schrieb Tait:
Show 9 quoted lines
> René Scharfe <rene.scharfe_lsrfire.ath.cx> said (on 2011/08/01):
>> Take long option names for -A (--after-context), -B (--before-context)
>> and -C (--context) from GNU grep and add a similar long option name
>> for -W (--function-context).
> 
> Why not just add --context=function? Then when I want --context=indent
> to give context based on the indent-level, it is an intuitive extension
> of the existing options. (Of course, --context=<number> would still do
> exactly what it does now.)

With the current patches, you can use --function-context together with --context=<num> to specify a minimum number of context lines to show, even beyond function boundaries.

I'd expect a --context=function option to be equivalent to -W -C0 and --context=<num> to be equivalent to -C<num> --no-function-context, so the syntax would be limited in that regard (or be unintuitive to me).

We can still add it on top, though.
René
Previous: Tait
Message 11 of 11 in “grep: add option to show whole function as context”
  1. grep: add option to show whole function as contextRené Scharfe, Jul 31, 2011
  2. Sverre RabbelierJul 31, 2011
  3. René ScharfeAug 1, 2011
  4. Sverre RabbelierAug 1, 2011
  5. René ScharfeAug 1, 2011
  6. 1/2 grep: add option to show whole function as contextRené Scharfe, Aug 1, 2011
  7. Junio C HamanoAug 1, 2011
  8. René ScharfeAug 2, 2011
  9. 2/2 grep: long context optionsRené Scharfe, Aug 1, 2011
  10. TaitAug 2, 2011
  11. René ScharfeAug 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.