emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode b1c664b 364/385: allow hsinspect populati


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode b1c664b 364/385: allow hsinspect population in the background
Date: Wed, 6 Oct 2021 00:00:05 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit b1c664bafaef9ffd8ac880e1e9ebdb9524ed9cc2
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    allow hsinspect population in the background
---
 haskell-tng-hsinspect.el | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index 7b26983..fb4c705 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -20,6 +20,7 @@
 (require 'array)
 (require 'subr-x)
 (require 'tar-mode)
+(require 'timer)
 (require 'url)
 
 ;; Popups are not supported in stock Emacs so an extension is necessary:
@@ -71,6 +72,10 @@ definition of the symbol in the build tool's source archive."
           ;;      unexported modules for inplace packages. It's starting to
           ;;      sound like a very complex feature... and perhaps not worth
           ;;      implementing given that TAGS work just great.
+          ;;
+          ;; FIXME or implement this by constructing the expected path/filename
+          ;;      from the module name and then just find files having that 
name
+          ;;      and pick the first one. Should work 99% of the time.
           (error "%s is defined in a local package" qualified)
         (when-let* ((srcid (or internal-srcid (alist-get 'srcid pkg-entry)))
                     (module (or internal-module (alist-get 'module 
module-entry)))
@@ -531,5 +536,26 @@ This is uncached, prefer `haskell-tng--hsinspect-exe'."
   (haskell-tng--hsinspect-imports nil alt)
   (haskell-tng--hsinspect-index alt))
 
+(defcustom haskell-tng-hsinspect-auto -1
+  "Automatically run `hsinspect'.
+
+Runs after the given number of idle seconds, ignoring errors.
+Negative to disable."
+  :type 'integerp
+  :group 'haskell-tng)
+
+(defun haskell-tng-hsinspect-hook ()
+  (when (<= 0 haskell-tng-hsinspect-auto)
+    (run-with-idle-timer
+     haskell-tng-hsinspect-auto
+     nil
+     (lambda ()
+       (message "Running hsinspect in the background")
+       (make-thread #'haskell-tng-hsinspect)))))
+
+(add-hook
+ 'haskell-tng-mode-hook
+ #'haskell-tng-hsinspect-hook)
+
 (provide 'haskell-tng-hsinspect)
 ;;; haskell-tng-hsinspect.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]