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

Re: [PATCH] diff: add ruby funcname pattern

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Aug 1, 2008, 08:11 UTC
Message-ID
<cb7bb73a0808010111j29e2085etd58150037b55063c@mail.gmail.com>
In-Reply-To
<7vmyjxtco3.fsf@gitster.siamese.dyndns.org>
On Fri, Aug 1, 2008 at 9:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks.
>
> I do not talk Ruby,
You're really missing into something ;)
Show 14 quoted lines
> so I'll wait for a few days to hear any one of the
> following happen before deciding what to do with this patch:
>
>  (1) Yeah, this is a sufficient and necessary set of keywords, and it
>     would make my Ruby life so much better;
>
>  (2) This might be a good start but you need to cover this and that
>     keywords as well;
>
>  (3) This will misidentify a line that is not the beginning of a
>     definition, and should not be applied;
>
> Needless to say, "Here is a better patch" is appreciated if somebody says
> (2) or (3).

I wasn't sure about the completeness of the regexp myself, which is why I asked in #ruby on freenode for additional suggestions. The only reply I got was an idea to add a number of block-based coding sections such as Procs an Threads by matching .*\.new ({|do) as well.

This is something I had been thinking about myself, but I decided to discard the idea because the current chunk text detection in git does not have a way to say 'this is the end of a function, so get back to the previous chunk (con)text' instead of using the last chunk text: so if I have methodx followed by methody and make a change near the top of methody I get methodx in the chunk text.

This limitation, that affects all funcname parsers, has kept me from adding Proc, Thread and other anonymous code blocks to the Ruby funcname, because having the proper context for changed code after an anonymous block is IMO better than having specific context in the anonymous block itself.

OTOH, if the funcname capability was expand to a full stack manipulation (push chunk text, pop chunk text) ... (and yes, if I ever find a sane way to do it myself I *will* provide a patch)

-- 
Giuseppe "Oblomov" Bilotta
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 14 in “diff: add ruby funcname pattern”
  1. diff: add ruby funcname patternGiuseppe Bilotta, Jul 31, 2008
  2. Junio C HamanoAug 1, 2008
  3. Giuseppe BilottaAug 1, 2008
  4. Junio C HamanoAug 1, 2008
  5. Giuseppe BilottaAug 1, 2008
  6. Jeff KingAug 1, 2008
  7. Kevin BallardAug 2, 2008
  8. Junio C HamanoAug 2, 2008
  9. Giuseppe BilottaAug 2, 2008
  10. Kevin BallardAug 2, 2008
  11. Giuseppe BilottaAug 2, 2008
  12. Johannes SchindelinAug 2, 2008
  13. Giuseppe BilottaAug 2, 2008
  14. Lee MarlowAug 2, 2008

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.