defining ghc-executable-find.

This commit is contained in:
Kazu Yamamoto 2014-03-13 22:21:58 +09:00
parent 0fac26e350
commit 63e59cbebd
4 changed files with 14 additions and 14 deletions

View File

@ -96,8 +96,7 @@ unloaded modules are loaded")
;;;
(defun ghc-boot (n)
(if (not (executable-find ghc-module-command))
(message "%s not found" ghc-module-command)
(ghc-executable-find ghc-module-command
(ghc-read-lisp-list
(lambda ()
(message "Initializing...")
@ -106,8 +105,7 @@ unloaded modules are loaded")
n)))
(defun ghc-load-modules (mods)
(if (not (executable-find ghc-module-command))
(message "%s not found" ghc-module-command)
(ghc-executable-find ghc-module-command
(ghc-read-lisp-list
(lambda ()
(message "Loading names...")

View File

@ -162,16 +162,20 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ghc-run-ghc-mod (cmds)
(cond
((executable-find ghc-module-command)
(ghc-executable-find ghc-module-command
(let ((cdir default-directory))
(with-temp-buffer
(cd cdir)
(apply 'call-process ghc-module-command nil t nil
(append (ghc-make-ghc-options) cmds))
(buffer-substring (point-min) (1- (point-max))))))
(t
(message "%s not found" ghc-module-command)
nil)))
(buffer-substring (point-min) (1- (point-max)))))))
(defmacro ghc-executable-find (cmd &rest body)
;; (declare (indent 1))
`(if (not (executable-find ,cmd))
(message "\"%s\" not found" ,cmd)
,@body))
(put 'ghc-executable-find 'lisp-indent-function 1)
(provide 'ghc-func)

View File

@ -77,8 +77,7 @@
(defun ghc-show-type ()
(interactive)
(if (not (executable-find ghc-module-command))
(message "%s not found" ghc-module-command)
(ghc-executable-find ghc-module-command
(let ((modname (or (ghc-find-module-name) "Main")))
(ghc-show-type0 modname))))

View File

@ -12,8 +12,7 @@
(defun ghc-insert-module ()
(interactive)
(if (not (executable-find ghc-hoogle-command))
(message "\"%s\" not found" ghc-hoogle-command)
(ghc-executable-find ghc-hoogle-command
(let* ((expr0 (ghc-things-at-point))
(expr (ghc-read-expression expr0)))
(let ((mods (ghc-function-to-modules expr)))