Subject: bug#36459: 27.0.50; octave-mode ElDoc support bug

From: Leo Liu <[email-masked]>
Date: Sat, 06 Jul 2019 21:02:10 +0800

On 2019-07-03 17:43 +0300, Dmitry Gutov wrote:
> Paging the original author.
>
> Leo, are you still using Octave? What do you think about the issue?

Sadly I never become a serious octave user. It is possible these
functions stop working given octave seems to evolve fast these days.

On 2019-07-04 13:15 -0300, Mauro Aranda wrote:
> I forgot to say that my version of GNU Octave is 4.0.0
>
> The problem is with the regexp used in
> octave-eldoc-function-signatures.  It matches the signatures of the
> function, that are output with a call to the GNU Octave function
> print_usage.  It also matches an old-style of outputting these function
> signatures, which was:
> usage:  bar = foo ()
>
> This output was also generated by calling the GNU Octave function usage,
> like this:
> usage ("bar = foo ()")
> But usage has been deprecated in GNU Octave, I think in major version 4.
> It's still present in my version, but I don't know about latest releases
> (there's a recent GNU Octave 5.1.0)
>
> I don't know why the author chose print_usage over the GNU Octave
> function help, but when print_usage fails, due to being called with a
> nonexistent function in his argument, like this:
> print_usage ('A')
> An error message like this one is output:
> error: print_usage: 'A' not found
>
> The regexp used is wrongly matching this line and therefore
> octave-eldoc-function-signatures is not returning nil, as it should in
> this case.

Can this bug be fixed by changing the regexp in
`octave-eldoc-function-signatures' from

        "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$"

to

        "\\s-*\\(?:--[^:]+\\|\\_<usage\\):\\s-*\\(.*\\)$"
?

BTW I can't remember why print_usage was chosen. It could be it was the
one I found that worked.

> Best regards,
> Mauro.

Thanks for the report.