Commit cb0403d7 authored by Mauro Aranda's avatar Mauro Aranda Committed by Leo Liu

Fix octave-mode ElDoc support

* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Fix the
regexp used, so no match happens when there is no defined function FN.
Also, tweak the regexp to support GNU Octave 4.2.x and newer.  (Bug#36459)
parent 691790b8
Pipeline #2793 passed with stage
in 27 minutes and 12 seconds
......@@ -1591,8 +1591,23 @@ code line."
(list (format "print_usage ('%s');\n" fn)))
(let (result)
(dolist (line inferior-octave-output-list)
;; The help output has changed a few times in GNU Octave.
;; Earlier versions output "usage: " before the function signature.
;; After deprecating the usage function, and up until GNU Octave 4.0.3,
;; the output looks like this:
;; -- Mapping Function: abs (Z).
;; After GNU Octave 4.2.0, the output is less verbose and it looks like
;; this:
;; -- abs (Z)
;; The following regexp matches these three formats.
;; The "usage: " alternative matches the symbol, because a call to
;; print_usage with a non-existent function (e.g., print_usage ('A'))
;; would output:
;; error: print_usage: 'A' not found
;; and we wouldn't like to match anything in this case.
;; See bug #36459.
(when (string-match
"\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$"
"\\s-*\\(?:--[^:]+:\\|\\_<usage:\\|--\\)\\s-*\\(.*\\)$"
line)
(push (match-string 1 line) result)))
(setq octave-eldoc-cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment