27
27
; ;; Code:
28
28
29
29
(require 'ansi-color )
30
+ (require 'view )
30
31
(require 'haskell-mode )
31
32
(require 'haskell-utils )
32
33
@@ -70,13 +71,21 @@ is asked to show extra info for the items matching QUERY.."
70
71
(let* ((command (concat (if (functionp haskell-hoogle-command)
71
72
(funcall haskell-hoogle-command)
72
73
haskell-hoogle-command)
73
- (if info " -i " " " )
74
- " --color " (shell-quote-argument query)))
75
- (output (shell-command-to-string command)))
76
- (with-help-window " *hoogle*"
77
- (with-current-buffer standard-output
78
- (insert output)
79
- (ansi-color-apply-on-region (point-min ) (point-max )))))))
74
+ (if info " -i " " " )
75
+ " --color " (shell-quote-argument query)))
76
+ (output (shell-command-to-string command)))
77
+ (with-help-window " *hoogle*"
78
+ (with-current-buffer standard-output
79
+ (let ((outs (ansi-color-filter-apply output)))
80
+ (delay-mode-hooks (haskell-mode ))
81
+ (if info
82
+ (let ((lns (split-string output " \n " t " " )))
83
+ (insert (car lns) " \n\n " )
84
+ (dolist (ln (cdr lns)) (insert " -- " ln " \n " )))
85
+ (insert outs)
86
+ (forward-line -1 )
87
+ (when (looking-at-p " ^plus more results" ) (insert " \n -- " )))
88
+ (view-mode )))))))
80
89
81
90
;;;### autoload
82
91
(defalias 'hoogle 'haskell-hoogle )
@@ -89,9 +98,9 @@ is asked to show extra info for the items matching QUERY.."
89
98
90
99
(defcustom haskell-hoogle-server-command (lambda (port )
91
100
(list " hoogle" " server"
92
- " --local"
93
- " -p"
94
- (number-to-string port)))
101
+ " --local"
102
+ " -p"
103
+ (number-to-string port)))
95
104
" Command used to start the local hoogle server."
96
105
:group 'haskell
97
106
:type 'function
0 commit comments