aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/octave.el33
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 950c4ca33fa..47e1d017ffd 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1606,23 +1606,26 @@ code line."
1606 (const :tag "Multi Line" multiline)) 1606 (const :tag "Multi Line" multiline))
1607 :version "24.4") 1607 :version "24.4")
1608 1608
1609;; (FN SIGNATURE1 SIGNATURE2 ...) 1609;; (FN -> (SIGNATURE1 SIGNATURE2 ...))
1610(defvar octave-eldoc-cache nil) 1610(defvar octave-eldoc-cache (make-hash-table :test #'equal))
1611
1612(defun octave-eldoc-flush-cache ()
1613 "Flush the cache of function signatures for Eldoc."
1614 (clrhash octave-eldoc-cache))
1611 1615
1612(defun octave-eldoc-function-signatures (fn) 1616(defun octave-eldoc-function-signatures (fn)
1613 (unless (equal fn (car octave-eldoc-cache)) 1617 (or (gethash fn octave-eldoc-cache)
1614 (inferior-octave-send-list-and-digest 1618 (puthash fn
1615 (list (format "print_usage ('%s');\n" fn))) 1619 (let (result)
1616 (let (result) 1620 (inferior-octave-send-list-and-digest
1617 (dolist (line inferior-octave-output-list) 1621 (list (format "print_usage ('%s');\n" fn)))
1618 (when (string-match 1622 (dolist (line inferior-octave-output-list)
1619 "\\s-*\\(?:--[^:]+\\|usage\\):\\s-*\\(.*\\)$" 1623 (when (string-match
1620 line) 1624 "\\s-*\\(?:--\\|usage:\\)\\s-*\\(.*\\)$"
1621 (push (match-string 1 line) result))) 1625 line)
1622 (setq octave-eldoc-cache 1626 (push (match-string 1 line) result)))
1623 (cons (substring-no-properties fn) 1627 (nreverse result))
1624 (nreverse result))))) 1628 octave-eldoc-cache)))
1625 (cdr octave-eldoc-cache))
1626 1629
1627(defun octave-eldoc-function () 1630(defun octave-eldoc-function ()
1628 "A function for `eldoc-documentation-function' (which see)." 1631 "A function for `eldoc-documentation-function' (which see)."