]> gitweb.factorcode.org Git - factor.git/blobdiff - misc/fuel/fuel-autodoc.el
Use lexical scoping in all fuel sources
[factor.git] / misc / fuel / fuel-autodoc.el
index 2ac2926139d6336b70632eb8c4ce4356896c8bfd..9b6cb5f59d07fbab66a0b49501ca41b6977edfb8 100644 (file)
@@ -1,4 +1,4 @@
-;;; fuel-autodoc.el -- doc snippets in the echo area
+;;; fuel-autodoc.el -- doc snippets in the echo area -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2008, 2009 Jose Antonio Ortega Ruiz
 ;; See http://factorcode.org/license.txt for BSD license.
   :group 'fuel-autodoc
   :type 'boolean)
 
-
-(defcustom fuel-autodoc-eval-using-form-p nil
-  "When enabled, automatically load vocabularies in USING: form
-to display autodoc messages.
-
-In order to show autodoc messages for words in a Factor buffer,
-the used vocabularies must be loaded in the Factor image. Setting
-this variable to `t' will do that automatically for you,
-asynchronously. That means that you'll be able to move around
-while the vocabs are being loaded, but no other FUEL
-functionality will be available until loading finishes (and it
-may take a while). Thus, this functionality is disabled by
-default. You can force loading the vocabs in a Factor buffer
-USING: form with \\[fuel-load-usings]."
-  :group 'fuel-autodoc
-  :type 'boolean)
-
 \f
 ;;; Eldoc function:
 
@@ -57,16 +40,16 @@ USING: form with \\[fuel-load-usings]."
   (let ((word (or word (factor-symbol-at-point)))
         (fuel-log--inhibit-p t))
     (when word
-      (let* ((usings (if fuel-autodoc-eval-using-form-p :usings t))
-             (cmd (if (factor-on-vocab)
-                      `(:fuel* (,word fuel-vocab-summary) :in t)
-                    `(:fuel* ((,word :usings fuel-word-synopsis)) t ,usings)))
-             (ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
-             (res (fuel-eval--retort-result ret)))
-        (when (and ret (not (fuel-eval--retort-error ret)) (stringp res))
-          (if fuel-autodoc-minibuffer-font-lock
-              (factor-font-lock-string res)
-            res))))))
+      (let ((cmd `(:fuel* (,word ,'fuel-word-synopsis)
+                          ,(factor-current-vocab)
+                          ,(factor-usings))))
+        (let* ((ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
+               (res (fuel-eval--retort-result ret)))
+          (if (not res)
+              (message "No synposis for '%s'" word)
+            (if fuel-autodoc-minibuffer-font-lock
+                (factor-font-lock-string res)
+              res)))))))
 
 (defvar-local fuel-autodoc--fallback-function nil)