[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-mode 20d4e23003 3/3: Merge pull request #1786 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-mode 20d4e23003 3/3: Merge pull request #1786 from jaor/master |
Date: |
Sat, 4 Mar 2023 05:00:15 -0500 (EST) |
branch: elpa/haskell-mode
commit 20d4e2300302a9af673e82d0185d3f489bfb0f59
Merge: 810b08e317 4206520ba9
Author: Steve Purcell <steve@sanityinc.com>
Commit: GitHub <noreply@github.com>
Merge pull request #1786 from jaor/master
Hoogle: colorize hoogle cli output using haskell-mode font-lock
---
haskell-hoogle.el | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/haskell-hoogle.el b/haskell-hoogle.el
index 86835b7f7e..857af921ca 100644
--- a/haskell-hoogle.el
+++ b/haskell-hoogle.el
@@ -27,6 +27,7 @@
;;; Code:
(require 'ansi-color)
+(require 'view)
(require 'haskell-mode)
(require 'haskell-utils)
@@ -70,13 +71,21 @@ is asked to show extra info for the items matching QUERY.."
(let* ((command (concat (if (functionp haskell-hoogle-command)
(funcall haskell-hoogle-command)
haskell-hoogle-command)
- (if info " -i " "")
- " --color " (shell-quote-argument query)))
- (output (shell-command-to-string command)))
- (with-help-window "*hoogle*"
- (with-current-buffer standard-output
- (insert output)
- (ansi-color-apply-on-region (point-min) (point-max)))))))
+ (if info " -i " "")
+ " --color " (shell-quote-argument query)))
+ (output (shell-command-to-string command)))
+ (with-help-window "*hoogle*"
+ (with-current-buffer standard-output
+ (let ((outs (ansi-color-filter-apply output)))
+ (delay-mode-hooks (haskell-mode))
+ (if info
+ (let ((lns (split-string output "\n" t " ")))
+ (insert (car lns) "\n\n")
+ (dolist (ln (cdr lns)) (insert "-- " ln "\n")))
+ (insert outs)
+ (forward-line -1)
+ (when (looking-at-p "^plus more results") (insert "\n-- ")))
+ (view-mode)))))))
;;;###autoload
(defalias 'hoogle 'haskell-hoogle)
@@ -89,9 +98,9 @@ is asked to show extra info for the items matching QUERY.."
(defcustom haskell-hoogle-server-command (lambda (port)
(list "hoogle" "server"
- "--local"
- "-p"
- (number-to-string port)))
+ "--local"
+ "-p"
+ (number-to-string port)))
"Command used to start the local hoogle server."
:group 'haskell
:type 'function