diff --git a/elisp/ghc-func.el b/elisp/ghc-func.el index 541ce71..7884783 100644 --- a/elisp/ghc-func.el +++ b/elisp/ghc-func.el @@ -160,14 +160,15 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun ghc-run-ghc-mod (cmds) - (ghc-executable-find ghc-module-command - (let ((cdir default-directory)) - (with-temp-buffer - (cd cdir) - (apply 'ghc-call-process ghc-module-command nil t nil - (append (ghc-make-ghc-options) cmds)) - (buffer-substring (point-min) (1- (point-max))))))) +(defun ghc-run-ghc-mod (cmds &optional prog) + (let ((target (or prog ghc-module-command))) + (ghc-executable-find target + (let ((cdir default-directory)) + (with-temp-buffer + (cd cdir) + (apply 'ghc-call-process target nil t nil + (append (ghc-make-ghc-options) cmds)) + (buffer-substring (point-min) (1- (point-max)))))))) (defmacro ghc-executable-find (cmd &rest body) ;; (declare (indent 1)) diff --git a/elisp/ghc.el b/elisp/ghc.el index 73d9262..702627b 100644 --- a/elisp/ghc.el +++ b/elisp/ghc.el @@ -7,6 +7,7 @@ ;; Put the following code to your "~/.emacs". ;; ;; (autoload 'ghc-init "ghc" nil t) +;; (autoload 'ghc-debug "ghc" nil t) ;; (add-hook 'haskell-mode-hook (lambda () (ghc-init))) ;; ;; Or if you wish to display error each goto next/prev error, @@ -103,4 +104,24 @@ (defun ghc-abbrev-init () (set (make-local-variable 'dabbrev-case-fold-search) nil)) +;;;###autoload +(defun ghc-debug () + (interactive) + (let ((el-path (locate-file "ghc.el" load-path)) + (ghc-mod-path (executable-find ghc-module-command)) + (ghc-modi-path (executable-find ghc-interactive-command)) + (el-ver ghc-version) + (ghc-mod-ver (ghc-run-ghc-mod '("version"))) + (ghc-modi-ver (ghc-run-ghc-mod '("version") ghc-interactive-command))) + (switch-to-buffer (get-buffer-create "**GHC Debug**")) + (erase-buffer) + (insert "Path: check if you are using intended programs.\n") + (insert (format "\tghc.el path: \t%s\n" el-path)) + (insert (format "\tghc-mod path: \t%s\n" ghc-mod-path)) + (insert (format "\tghc-modi path: \t%s\n" ghc-modi-path)) + (insert "\nVersion: all versions must be the same.\n") + (insert (format "\t ghc.el version %s\n" el-ver)) + (insert (format "\t %s\n" ghc-mod-ver)) + (insert (format "\t%s\n" ghc-modi-ver)))) + (provide 'ghc)