Function: octave-eldoc-function

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

Signature

(octave-eldoc-function &rest IGNORED)

Documentation

A function for eldoc-documentation-functions (which see).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/octave.el.gz
(defun octave-eldoc-function (&rest _ignored)
  "A function for `eldoc-documentation-functions' (which see)."
  (when (inferior-octave-process-live-p)
    (let* ((ppss (syntax-ppss))
           (paren-pos (cadr ppss))
           (fn (save-excursion
                 (if (and paren-pos
                          ;; PAREN-POS must be after the prompt.
                          (or (not (eq (get-buffer-process (current-buffer))
                                       inferior-octave-process))
                              (< (process-mark inferior-octave-process)
                                 paren-pos))
                          (eq (char-after paren-pos) ?\())
                     (goto-char paren-pos)
                   (setq paren-pos nil))
                 (when (or (< (skip-syntax-backward "-") 0) paren-pos)
                   (thing-at-point 'symbol))))
           (sigs (and fn (octave-eldoc-function-signatures fn)))
           (oneline (mapconcat 'identity sigs
                               (propertize " | " 'face 'warning)))
           (multiline (mapconcat (lambda (s) (concat "-- " s)) sigs "\n")))
      ;;
      ;; Return the value according to style.
      (pcase octave-eldoc-message-style
        ('auto (if (< (length oneline) (window-width (minibuffer-window)))
                   oneline
                 multiline))
        ('oneline oneline)
        ('multiline multiline)))))