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

Re: [PATCH 1/2] userdiff: add support for R programming language

From
Junio C Hamano <gitster@pobox.com>
Date
May 27, 2025, 15:04 UTC
Message-ID
<xmqq4ix6rt75.fsf@gitster.g>
In-Reply-To
<385d7189-98fa-4863-8bcf-905c76eccbc8@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 8 quoted lines
>> +	"^[ \t]*([a-zA-z][a-zA-Z0-9_.]*[ \t]*<-[ \t]*function.*)$",
>
> I wonder how useful this is in practice. Unlike C or Java for example,
> code can live outside of functions in R scripts. If you have a script
> without any functions, there would not be any hunk headers. If you have
> a script with a mix of functions and code outside of functions, the code
> after a function would be attributed to the function. I'm not saying
> that this is bad, but just asking if this is part of the plan.
Isn't it the same as shell, perl, python, e-lisp and perhaps others?

If we can reliably detect that we are outside of any function and set it to an empty string that would be great ;-).

Show 8 quoted lines
>> +	/* -- */
>> +	"[a-zA-Z_][a-zA-Z0-9_.]*"),
>
> This singles out identifiers. Every single other characters would be its
> own word. I'd consider this a disimprovement. If you are not prepared to
> provide worddiff patterns, I recommend to use "[^ \t]+", which roughly
> amounts to the default behavior. It can be improved incrementally in
> later patches.
Good point.
> Please squash the test cases into this patch. Don't forget to test an
> indented function, and while at it, test a function definition *nested*
> in a function definition: that documents what the expected outcome is.
Again, good point.
Thanks.
Previous: Johannes SixtNext: Rodrigo Carvalho
Message 5 of 9 in “userdiff: add support for R programming language”
  1. 1/2 userdiff: add support for R programming languageRodrigo Carvalho, May 25, 2025
  2. 2/2 t4018: add two userdiff tests for R languageRodrigo Carvalho, May 25, 2025
  3. Eric SunshineMay 25, 2025
  4. Johannes SixtMay 26, 2025
  5. Junio C HamanoMay 27, 2025
  6. Rodrigo CarvalhoMay 29, 2025
  7. userdiff: add support for R programming languageRodrigo Carvalho, May 29, 2025
  8. Junio C HamanoJun 3, 2025
  9. Johannes SixtJun 3, 2025

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.