diff options
-rw-r--r-- | elisp/geiser-autodoc.el | 44 | ||||
-rw-r--r-- | elisp/geiser-compile.el | 2 |
2 files changed, 17 insertions, 29 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el index 429d369..8ab89a6 100644 --- a/elisp/geiser-autodoc.el +++ b/elisp/geiser-autodoc.el @@ -54,39 +54,27 @@ when `geiser-autodoc-display-module-p' is on." (make-variable-buffer-local (defvar geiser-autodoc--cached-signatures nil)) -(defun geiser-autodoc--clean-cache (&optional whole) - (if whole - (setq geiser-autodoc--cached-signatures nil) - (let ((s (car (last (geiser-syntax--locals-around-point nil nil)))) - (cache)) - (when s - (dolist (item geiser-autodoc--cached-signatures) - (unless (string-equal s (car item)) (push item cache))) - (setq geiser-autodoc--cached-signatures (nreverse cache)))))) - -(defun geiser-autodoc--save-signatures (ret) - (let ((res (geiser-eval--retort-result ret))) +(defsubst geiser-autodoc--clean-cache () + (setq geiser-autodoc--cached-signatures nil)) + +(defun geiser-autodoc--show-signatures (ret) + (let ((res (geiser-eval--retort-result ret)) + (signs)) (when res (dolist (item res) - (push (cons (format "%s" (car item)) (cdr item)) - geiser-autodoc--cached-signatures)) - (let ((str (geiser-autodoc--autodoc (geiser-syntax--scan-sexps) - geiser-autodoc--cached-signatures))) - (when str (eldoc-message str)))))) + (push (cons (format "%s" (car item)) (cdr item)) signs)) + (let ((str (geiser-autodoc--autodoc (geiser-syntax--scan-sexps) signs))) + (when str (eldoc-message str))) + (setq geiser-autodoc--cached-signatures signs)))) (defun geiser-autodoc--get-signatures (funs) (when funs - (let ((missing) (cached)) - (if (not geiser-autodoc--cached-signatures) - (setq missing funs) - (dolist (f funs) - (let ((cf (assoc f geiser-autodoc--cached-signatures))) - (if cf (push cf cached) (push f missing))))) - (when missing - (let ((m (format "'(%s)" (mapconcat 'identity missing " ")))) - (geiser-eval--send `(:eval (:ge autodoc (:scm ,m))) - 'geiser-autodoc--save-signatures))) - cached))) + (let ((m (format "'(%s)" (mapconcat 'identity funs " ")))) + (geiser-eval--send `(:eval (:ge autodoc (:scm ,m))) + 'geiser-autodoc--show-signatures))) + (and (or (assoc (car funs) geiser-autodoc--cached-signatures) + (assoc (cadr funs) geiser-autodoc--cached-signatures)) + geiser-autodoc--cached-signatures)) (defun geiser-autodoc--sanitize-args (args) (cond ((null args) nil) diff --git a/elisp/geiser-compile.el b/elisp/geiser-compile.el index f59f9e5..bc9aace 100644 --- a/elisp/geiser-compile.el +++ b/elisp/geiser-compile.el @@ -39,7 +39,7 @@ (path (cdr b/p)) (msg (format "%s %s ..." msg path))) (message msg) - (geiser-autodoc--clean-cache t) + (geiser-autodoc--clean-cache) (geiser-compile--display-result msg (geiser-eval--send/wait `(,(if compile-p :comp-file :load-file) ,path))))) |