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

Re: [PATCH] doc/gitattributes: add Octave

From
LI, BO XUAN <liboxuan@connect.hku.hk>
Date
May 11, 2019, 02:36 UTC
Message-ID
<CALM0=-mTLakSBW67vqHNX84p=uw990QDbpeUfh1HKq9N0CiiLA@mail.gmail.com>
In-Reply-To
<87woixx556.fsf@evledraar.gmail.com>

On Sat, May 11, 2019 at 7:26 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 38 quoted lines
>
>
> On Fri, May 10 2019, Boxuan Li wrote:
>
> > `matlab` pattern is also suitable for source code
> > in the GNU Octave language.
> >
> > Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
> > ---
> >  Documentation/gitattributes.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> > index 4fb20cd0e9..1b28381bda 100644
> > --- a/Documentation/gitattributes.txt
> > +++ b/Documentation/gitattributes.txt
> > @@ -819,7 +819,7 @@ patterns are available:
> >
> >  - `java` suitable for source code in the Java language.
> >
> > -- `matlab` suitable for source code in the MATLAB language.
> > +- `matlab` suitable for source code in the MATLAB/Octave language.
> >
> >  - `objc` suitable for source code in the Objective-C language.
>
> I've never used either, but browsing our patterns I see:
>
>          "^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$",
>
> I.e. that last bit matches ^%%, and then here:
> https://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB
>
>     MATLAB uses the percent sign '%' to begin a comment. Octave uses
>     both the hash symbol # and the percent sign % interchangeably.
>
> So here we have the "function" pattern matching a comment, right? (this
> doesn't have any tests) and we'd want to add "#" to Octave, but not
> MATLAB.

Thanks, that's a great catch! Actually, '%%' is used to start a code section in Matlab (https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html), while Octave uses both '%%' and '##' (https://octave.org/doc/interpreter/Sections.html).

>
> I see both tend to use the ".m" extension. Anyway, isn't it better to
> add an "octave" pattern, and document that they're mostly the same
I agree. I'll send an updated patch soon.
> (although it looks like we can add #-comments, to future-proof
> ourselves?
Previous: Ævar Arnfjörð BjarmasonNext: Boxuan Li
Message 4 of 22 in “doc/gitattributes: add Octave”
  1. doc/gitattributes: add OctaveBoxuan Li, May 10, 2019
  2. Philip OakleyMay 10, 2019
  3. Ævar Arnfjörð BjarmasonMay 10, 2019
  4. LI, BO XUANMay 11, 2019
  5. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 11, 2019
  6. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 11, 2019
  7. Junio C HamanoMay 15, 2019
  8. Johannes SixtMay 15, 2019
  9. LI, BO XUANMay 15, 2019
  10. Johannes SixtMay 15, 2019
  11. Junio C HamanoMay 16, 2019
  12. Johannes SixtMay 16, 2019
  13. Junio C HamanoMay 16, 2019
  14. LI, BO XUANMay 17, 2019
  15. Johannes SixtMay 17, 2019
  16. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 15, 2019
  17. userdiff: add OctaveBoxuan Li, May 18, 2019
  18. Johannes SixtMay 20, 2019
  19. userdiff: add OctaveBoxuan Li, May 21, 2019
  20. Junio C HamanoMay 28, 2019
  21. Johannes SixtMay 28, 2019
  22. userdiff: fix grammar and style issuesBoxuan Li, May 29, 2019

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.