tags:

views:

240

answers:

1

EDIT I'm using GNU Emacs 23.0.95.1 and Haskell-mode 2.4, both from ports

I used to use vim all the time, but have fallen in love with emacs and it's extensibility. I installed haskell-mode from ports on my FreeBSD 7.2 system, and everything seems to work fine so far except for the function haskell-hoogle. When I call the function it creates a new window that just says "Process hoogle finished" with no other content. Here is the code for the function for those who aren't familiar

(defcustom haskell-hoogle-command
  (if (executable-find "hoogle") "hoogle"))

(defun haskell-hoogle (query)
  "Do a Hoogle search for QUERY"
  (interactive
   (let ((def (haskell-ident-at-point)))
     (if (and def (symbolp def)) (setq def (symbol-name def)))
     (list (read-string (if def
                            (format "Hoogle query (default %s): " def)
                           "Hoogle query: ")
                        nil nil def))))
  (if (null haskell-hoogle-command)
      (browse-url (format "http://haskell.org/hoogle/?q=%s" query))
    (if (fboundp 'help-setup-xref)
        (help-setup-xref (list 'haskell-hoogle query) (interactive-p)))
    (with-output-to-temp-buffer
        (if (fboundp 'help-buffer) (help-buffer) "*Help*")
       (with-current-buffer standard-output
         (start-process "hoogle" (current-buffer) haskell-hoogle-commmand
                        query)))))

However, I have found that if print something to the temporary buffer just before the hoogle process is started then I get the expected output from hoogle. The following code produces the output, but it is prefixed with "" because of the call to print:

(defun haskell-hoogle (query)
  "Do a Hoogle search for QUERY"
  (interactive
   (let ((def (haskell-ident-at-point)))
     (if (and def (symbolp def)) (setq def (symbol-name def)))
     (list (read-string (if def
                            (format "Hoogle query (default %s): " def)
                           "Hoogle query: ")
                        nil nil def))))
  (if (null haskell-hoogle-command)
      (browse-url (format "http://haskell.org/hoogle/?q=%s" query))
    (if (fboundp 'help-setup-xref)
        (help-setup-xref (list 'haskell-hoogle query) (interactive-p)))
    (with-output-to-temp-buffer
        (if (fboundp 'help-buffer) (help-buffer) "*Help*")
       (print "")
       (with-current-buffer standard-output
         (start-process "hoogle" (current-buffer) haskell-hoogle-commmand
                        query)))))

I would like to figure out what's going on here; is there a problem with the haskell-mode code, is there something wrong with my system. I would really appreciate a bit of advice

Thanks James

A: 

So I upgraded to 23.1, but the result was the same. I did however notice something as I was playing with emacs: when I would call haskell-hoogle, the new buffer would only have a blank line and then the words "Process hoogle finished," but that's not all that was in the buffer... By scrolling up a little bit in the temp buffer I realized that everything was working perfectly, except the buffer was scrolled to the bottom, so now I feel pretty dumb.

On a related note, does anyone have any advice on a good line numbering script. I have tried setnu+, but it acted kind of strangely when I would delete a line...

Thanks James

James