Function: octave-eldoc-function-signatures

octave-eldoc-function-signatures is a byte-compiled function defined in octave.el.gz.

Signature

(octave-eldoc-function-signatures FN)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/octave.el.gz
(defun octave-eldoc-function-signatures (fn)
  (unless (equal fn (car octave-eldoc-cache))
    (while-no-input
      (inferior-octave-send-list-and-digest
       (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-*\\(.*\\)$"
               line)
          (push (match-string 1 line) result)))
      (setq octave-eldoc-cache
            (cons (substring-no-properties fn)
                  (nreverse result)))))
  (cdr octave-eldoc-cache))