From f690a85246ef338402cb906c285c5b0b9d8753d7 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 4 Jun 2015 11:21:26 -0700 Subject: [PATCH 1/5] add elispPath command to bootstrap elisp code from ghc-mod installation --- .gitignore | 1 + elisp-bootstrap/Makefile | 30 ++++++++++++++++++++++++++++++ elisp-bootstrap/ghc-mod.el | 11 +++++++++++ ghc-mod.cabal | 2 ++ src/GHCMod.hs | 13 +++++++++++-- 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 elisp-bootstrap/Makefile create mode 100644 elisp-bootstrap/ghc-mod.el diff --git a/.gitignore b/.gitignore index 155856000..2a95c9eb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ dist/ elisp/*.elc +elisp-bootstrap/*.elc *~ /.cabal-sandbox/ add-source-timestamps diff --git a/elisp-bootstrap/Makefile b/elisp-bootstrap/Makefile new file mode 100644 index 000000000..a3a62d9fb --- /dev/null +++ b/elisp-bootstrap/Makefile @@ -0,0 +1,30 @@ +SRCS = ghc-mod.el +EMACS = emacs +DETECT = xemacs + +TEMPFILE = temp.el + +all: $(TEMPFILE) ghc-mod.el + $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile + rm -f $(TEMPFILE) + +detect: $(TEMPFILE) ghc-mod.el + $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile + rm -f $(DETECT) + +$(TEMPFILE): + @echo '(setq load-path (cons "." load-path))' >> $(TEMPFILE) + @echo '(defun ghc-compile () (mapcar (lambda (x) (byte-compile-file x)) (list ' >> $(TEMPFILE) + @echo $(SRCS)| sed -e 's/\(ghc[^ ]*\.el\)/"\1"/g' >> $(TEMPFILE) + @echo ')))' >> $(TEMPFILE) + +clean: + rm -f *.elc $(TEMPFILE) + +VERSION = `grep version ghc.el | sed -e 's/[^0-9\.]//g'` + +bump: + echo "(define-package\n \"ghc-mod\"\n $(VERSION)\n \"Sub mode for Haskell mode\"\n nil)" > ghc-pkg.el + +archive: + git archive master -o ~/ghc-$(VERSION).tar --prefix=ghc-$(VERSION)/ diff --git a/elisp-bootstrap/ghc-mod.el b/elisp-bootstrap/ghc-mod.el new file mode 100644 index 000000000..a60d16998 --- /dev/null +++ b/elisp-bootstrap/ghc-mod.el @@ -0,0 +1,11 @@ +(defvar ghc-module-command "ghc-mod" +"*The command name of \"ghc-mod\"") +(defvar ghc-bootstrapped nil) + +(defun ghc-bootstrap () + (unless ghc-bootstrapped + (dolist (path (process-lines ghc-module-command "elispPath")) + (add-to-list 'load-path path) + (setq ghc-bootstrapped t))) + (when (fboundp 'ghc-init) + (ghc-init))) diff --git a/ghc-mod.cabal b/ghc-mod.cabal index bc5a01c26..60409f6da 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -31,6 +31,8 @@ Data-Files: elisp/Makefile Data-Files: LICENSE COPYING.BSD3 COPYING.AGPL3 Extra-Source-Files: ChangeLog SetupCompat.hs + elisp-bootstrap/Makefile + elisp-bootstrap/*.el NotCPP/*.hs test/data/annotations/*.hs test/data/broken-cabal/*.cabal diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 49e4099ab..0ceb45e8f 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -15,7 +15,7 @@ import Data.Char (isSpace) import Exception import Language.Haskell.GhcMod import Language.Haskell.GhcMod.Internal -import Paths_ghc_mod +import Paths_ghc_mod (version, getDataFileName) import System.Console.GetOpt (OptDescr(..), ArgDescr(..), ArgOrder(..)) import qualified System.Console.GetOpt as O import System.Directory (setCurrentDirectory) @@ -187,6 +187,9 @@ usage = \ - boot\n\ \ Internal command used by the emacs frontend.\n\ \\n\ + \ - elispPath\n\ + \ Internal command used by the emacs frontend.\n\ + \\n\ \ - legacy-interactive\n\ \ ghc-modi compatibility mode.\n" where @@ -401,6 +404,7 @@ legacyInteractiveLoop symdbreq ref world = do "refine" -> refineCmd args "boot" -> bootCmd [] + "elispPath" -> elispPathCmd [] "browse" -> browseCmd args "quit" -> liftIO $ exitSuccess @@ -410,6 +414,9 @@ legacyInteractiveLoop symdbreq ref world = do liftIO $ putStr res >> putStrLn "OK" >> hFlush stdout legacyInteractiveLoop symdbreq ref world +elispPath :: IOish m => GhcModT m String +elispPath = liftIO $ getDataFileName "elisp" + globalCommands :: [String] -> Maybe String globalCommands [] = Nothing globalCommands (cmd:_) = case cmd of @@ -443,6 +450,7 @@ ghcCommands (cmd:args) = do "doc" -> pkgDocCmd "dumpsym" -> dumpSymbolCmd "boot" -> bootCmd + "elispPath" -> elispPathCmd "legacy-interactive" -> legacyInteractiveCmd _ -> fatalError $ "unknown command: `" ++ cmd ++ "'" @@ -487,7 +495,7 @@ catchArgs cmd action = modulesCmd, languagesCmd, flagsCmd, browseCmd, checkSyntaxCmd, expandTemplateCmd, debugInfoCmd, componentInfoCmd, infoCmd, typesCmd, splitsCmd, sigCmd, refineCmd, autoCmd, findSymbolCmd, lintCmd, rootInfoCmd, pkgDocCmd, - dumpSymbolCmd, bootCmd, legacyInteractiveCmd + dumpSymbolCmd, bootCmd, legacyInteractiveCmd, elispPathCmd :: IOish m => [String] -> GhcModT m String modulesCmd = withParseCmd' "modules" s $ \[] -> modules @@ -499,6 +507,7 @@ rootInfoCmd = withParseCmd' "root" [] $ \[] -> rootInfo componentInfoCmd = withParseCmd' "debugComponent" [] $ \ts -> componentInfo ts -- internal bootCmd = withParseCmd' "boot" [] $ \[] -> boot +elispPathCmd = withParseCmd' "elispPath" [] $ \[] -> elispPath dumpSymbolCmd = withParseCmd' "dump" [] $ \[tmpdir] -> dumpSymbol tmpdir findSymbolCmd = withParseCmd' "find" [] $ \[sym] -> findSymbol sym From 624bd7c766ef90f86db0104a13484e1db79711c4 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 4 Jun 2015 11:42:53 -0700 Subject: [PATCH 2/5] add ghc-version handling to elisp-bootstrap --- elisp-bootstrap/Makefile | 2 +- elisp-bootstrap/ghc-mod.el | 1 + scripts/bump.sh | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/elisp-bootstrap/Makefile b/elisp-bootstrap/Makefile index a3a62d9fb..929857120 100644 --- a/elisp-bootstrap/Makefile +++ b/elisp-bootstrap/Makefile @@ -21,7 +21,7 @@ $(TEMPFILE): clean: rm -f *.elc $(TEMPFILE) -VERSION = `grep version ghc.el | sed -e 's/[^0-9\.]//g'` +VERSION = `grep version ghc-mod.el | sed -e 's/[^0-9\.]//g'` bump: echo "(define-package\n \"ghc-mod\"\n $(VERSION)\n \"Sub mode for Haskell mode\"\n nil)" > ghc-pkg.el diff --git a/elisp-bootstrap/ghc-mod.el b/elisp-bootstrap/ghc-mod.el index a60d16998..744042d0d 100644 --- a/elisp-bootstrap/ghc-mod.el +++ b/elisp-bootstrap/ghc-mod.el @@ -1,3 +1,4 @@ +(defconst ghc-version "0") (defvar ghc-module-command "ghc-mod" "*The command name of \"ghc-mod\"") (defvar ghc-bootstrapped nil) diff --git a/scripts/bump.sh b/scripts/bump.sh index 445622eee..28d0829fb 100755 --- a/scripts/bump.sh +++ b/scripts/bump.sh @@ -17,6 +17,9 @@ cd $(dirname $0)/.. sed -i 's/(defconst ghc-version ".*")/(defconst ghc-version "'"$VERSION"'")/' \ elisp/ghc.el +sed -i 's/(defconst ghc-version ".*")/(defconst ghc-version "'"$VERSION"'")/' \ + elisp-bootstrap/ghc-mod.el + sed -r -i 's/^(Version:[[:space:]]*)[0-9.]+/\1'"$VERSION"'/' ghc-mod.cabal ( tac ChangeLog; echo "\n$(date '+%Y-%m-%d') v$VERSION" ) | tac \ @@ -26,6 +29,6 @@ mv ChangeLog.tmp ChangeLog emacs -q -nw ChangeLog -git add ChangeLog elisp/ghc.el ghc-mod.cabal +git add ChangeLog elisp/ghc.el elisp-bootstrap/ghc-mod.el ghc-mod.cabal git commit -m "Bump version to $VERSION" git tag "v$VERSION" From 8c03f870f34cf1dd9fb6d70d6a82714128d40ee5 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 4 Jun 2015 15:12:29 -0700 Subject: [PATCH 3/5] rename ghc-bootstrap to ghc-mod-init, add autoload comment --- elisp-bootstrap/ghc-mod.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elisp-bootstrap/ghc-mod.el b/elisp-bootstrap/ghc-mod.el index 744042d0d..4bfa76838 100644 --- a/elisp-bootstrap/ghc-mod.el +++ b/elisp-bootstrap/ghc-mod.el @@ -3,7 +3,8 @@ "*The command name of \"ghc-mod\"") (defvar ghc-bootstrapped nil) -(defun ghc-bootstrap () +;;;###autoload +(defun ghc-mod-init () (unless ghc-bootstrapped (dolist (path (process-lines ghc-module-command "elispPath")) (add-to-list 'load-path path) From cb47fea0398708293941d32399a60b58d51173b3 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 4 Jun 2015 15:16:09 -0700 Subject: [PATCH 4/5] move elisp to elisp-internal, elisp-bootstrap to elisp --- .gitignore | 2 +- {elisp-bootstrap => elisp-internal}/Makefile | 9 +++++---- {elisp => elisp-internal}/ghc-check.el | 0 {elisp => elisp-internal}/ghc-command.el | 0 {elisp => elisp-internal}/ghc-comp.el | 0 {elisp => elisp-internal}/ghc-doc.el | 0 {elisp => elisp-internal}/ghc-func.el | 0 {elisp => elisp-internal}/ghc-indent.el | 0 {elisp => elisp-internal}/ghc-info.el | 0 {elisp => elisp-internal}/ghc-ins-mod.el | 0 {elisp => elisp-internal}/ghc-pkg.el | 0 {elisp => elisp-internal}/ghc-process.el | 0 {elisp => elisp-internal}/ghc-rewrite.el | 0 {elisp => elisp-internal}/ghc.el | 0 elisp/Makefile | 9 ++++----- {elisp-bootstrap => elisp}/ghc-mod.el | 0 ghc-mod.cabal | 8 ++++---- scripts/bump.sh | 2 +- src/GHCMod.hs | 2 +- 19 files changed, 16 insertions(+), 16 deletions(-) rename {elisp-bootstrap => elisp-internal}/Makefile (72%) rename {elisp => elisp-internal}/ghc-check.el (100%) rename {elisp => elisp-internal}/ghc-command.el (100%) rename {elisp => elisp-internal}/ghc-comp.el (100%) rename {elisp => elisp-internal}/ghc-doc.el (100%) rename {elisp => elisp-internal}/ghc-func.el (100%) rename {elisp => elisp-internal}/ghc-indent.el (100%) rename {elisp => elisp-internal}/ghc-info.el (100%) rename {elisp => elisp-internal}/ghc-ins-mod.el (100%) rename {elisp => elisp-internal}/ghc-pkg.el (100%) rename {elisp => elisp-internal}/ghc-process.el (100%) rename {elisp => elisp-internal}/ghc-rewrite.el (100%) rename {elisp => elisp-internal}/ghc.el (100%) rename {elisp-bootstrap => elisp}/ghc-mod.el (100%) diff --git a/.gitignore b/.gitignore index 2a95c9eb7..d5f038de7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ dist/ elisp/*.elc -elisp-bootstrap/*.elc +elisp-internal/*.elc *~ /.cabal-sandbox/ add-source-timestamps diff --git a/elisp-bootstrap/Makefile b/elisp-internal/Makefile similarity index 72% rename from elisp-bootstrap/Makefile rename to elisp-internal/Makefile index 929857120..96bec8b98 100644 --- a/elisp-bootstrap/Makefile +++ b/elisp-internal/Makefile @@ -1,14 +1,15 @@ -SRCS = ghc-mod.el +SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el ghc-check.el ghc-process.el \ + ghc-command.el ghc-info.el ghc-ins-mod.el ghc-indent.el ghc-rewrite.el EMACS = emacs DETECT = xemacs TEMPFILE = temp.el -all: $(TEMPFILE) ghc-mod.el +all: $(TEMPFILE) ghc.el $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile rm -f $(TEMPFILE) -detect: $(TEMPFILE) ghc-mod.el +detect: $(TEMPFILE) ghc.el $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile rm -f $(DETECT) @@ -21,7 +22,7 @@ $(TEMPFILE): clean: rm -f *.elc $(TEMPFILE) -VERSION = `grep version ghc-mod.el | sed -e 's/[^0-9\.]//g'` +VERSION = `grep version ghc.el | sed -e 's/[^0-9\.]//g'` bump: echo "(define-package\n \"ghc-mod\"\n $(VERSION)\n \"Sub mode for Haskell mode\"\n nil)" > ghc-pkg.el diff --git a/elisp/ghc-check.el b/elisp-internal/ghc-check.el similarity index 100% rename from elisp/ghc-check.el rename to elisp-internal/ghc-check.el diff --git a/elisp/ghc-command.el b/elisp-internal/ghc-command.el similarity index 100% rename from elisp/ghc-command.el rename to elisp-internal/ghc-command.el diff --git a/elisp/ghc-comp.el b/elisp-internal/ghc-comp.el similarity index 100% rename from elisp/ghc-comp.el rename to elisp-internal/ghc-comp.el diff --git a/elisp/ghc-doc.el b/elisp-internal/ghc-doc.el similarity index 100% rename from elisp/ghc-doc.el rename to elisp-internal/ghc-doc.el diff --git a/elisp/ghc-func.el b/elisp-internal/ghc-func.el similarity index 100% rename from elisp/ghc-func.el rename to elisp-internal/ghc-func.el diff --git a/elisp/ghc-indent.el b/elisp-internal/ghc-indent.el similarity index 100% rename from elisp/ghc-indent.el rename to elisp-internal/ghc-indent.el diff --git a/elisp/ghc-info.el b/elisp-internal/ghc-info.el similarity index 100% rename from elisp/ghc-info.el rename to elisp-internal/ghc-info.el diff --git a/elisp/ghc-ins-mod.el b/elisp-internal/ghc-ins-mod.el similarity index 100% rename from elisp/ghc-ins-mod.el rename to elisp-internal/ghc-ins-mod.el diff --git a/elisp/ghc-pkg.el b/elisp-internal/ghc-pkg.el similarity index 100% rename from elisp/ghc-pkg.el rename to elisp-internal/ghc-pkg.el diff --git a/elisp/ghc-process.el b/elisp-internal/ghc-process.el similarity index 100% rename from elisp/ghc-process.el rename to elisp-internal/ghc-process.el diff --git a/elisp/ghc-rewrite.el b/elisp-internal/ghc-rewrite.el similarity index 100% rename from elisp/ghc-rewrite.el rename to elisp-internal/ghc-rewrite.el diff --git a/elisp/ghc.el b/elisp-internal/ghc.el similarity index 100% rename from elisp/ghc.el rename to elisp-internal/ghc.el diff --git a/elisp/Makefile b/elisp/Makefile index 96bec8b98..929857120 100644 --- a/elisp/Makefile +++ b/elisp/Makefile @@ -1,15 +1,14 @@ -SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el ghc-check.el ghc-process.el \ - ghc-command.el ghc-info.el ghc-ins-mod.el ghc-indent.el ghc-rewrite.el +SRCS = ghc-mod.el EMACS = emacs DETECT = xemacs TEMPFILE = temp.el -all: $(TEMPFILE) ghc.el +all: $(TEMPFILE) ghc-mod.el $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile rm -f $(TEMPFILE) -detect: $(TEMPFILE) ghc.el +detect: $(TEMPFILE) ghc-mod.el $(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f ghc-compile rm -f $(DETECT) @@ -22,7 +21,7 @@ $(TEMPFILE): clean: rm -f *.elc $(TEMPFILE) -VERSION = `grep version ghc.el | sed -e 's/[^0-9\.]//g'` +VERSION = `grep version ghc-mod.el | sed -e 's/[^0-9\.]//g'` bump: echo "(define-package\n \"ghc-mod\"\n $(VERSION)\n \"Sub mode for Haskell mode\"\n nil)" > ghc-pkg.el diff --git a/elisp-bootstrap/ghc-mod.el b/elisp/ghc-mod.el similarity index 100% rename from elisp-bootstrap/ghc-mod.el rename to elisp/ghc-mod.el diff --git a/ghc-mod.cabal b/ghc-mod.cabal index 60409f6da..054043735 100644 --- a/ghc-mod.cabal +++ b/ghc-mod.cabal @@ -26,13 +26,13 @@ Description: Category: GHC, Development Cabal-Version: >= 1.14 Build-Type: Custom -Data-Files: elisp/Makefile - elisp/*.el +Data-Files: elisp-internal/Makefile + elisp-internal/*.el Data-Files: LICENSE COPYING.BSD3 COPYING.AGPL3 Extra-Source-Files: ChangeLog SetupCompat.hs - elisp-bootstrap/Makefile - elisp-bootstrap/*.el + elisp/Makefile + elisp/*.el NotCPP/*.hs test/data/annotations/*.hs test/data/broken-cabal/*.cabal diff --git a/scripts/bump.sh b/scripts/bump.sh index 28d0829fb..95ae485fe 100755 --- a/scripts/bump.sh +++ b/scripts/bump.sh @@ -29,6 +29,6 @@ mv ChangeLog.tmp ChangeLog emacs -q -nw ChangeLog -git add ChangeLog elisp/ghc.el elisp-bootstrap/ghc-mod.el ghc-mod.cabal +git add ChangeLog elisp-internal/ghc.el elisp/ghc-mod.el ghc-mod.cabal git commit -m "Bump version to $VERSION" git tag "v$VERSION" diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 0ceb45e8f..5638c2c54 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -415,7 +415,7 @@ legacyInteractiveLoop symdbreq ref world = do legacyInteractiveLoop symdbreq ref world elispPath :: IOish m => GhcModT m String -elispPath = liftIO $ getDataFileName "elisp" +elispPath = liftIO $ getDataFileName "elisp-internal" globalCommands :: [String] -> Maybe String globalCommands [] = Nothing From f5173dbcb36a1da1e72ea92ca026436f400ee546 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 4 Jun 2015 16:10:30 -0700 Subject: [PATCH 5/5] use ghc-mod / ghc-mod-internal naming scheme --- elisp-internal/ghc-mod-internal-pkg.el | 5 +++ .../{ghc.el => ghc-mod-internal.el} | 36 ++++++++--------- elisp/ghc-mod.el | 39 ++++++++++++++++--- {elisp-internal => elisp}/ghc-pkg.el | 0 scripts/bump.sh | 8 ++-- 5 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 elisp-internal/ghc-mod-internal-pkg.el rename elisp-internal/{ghc.el => ghc-mod-internal.el} (84%) rename {elisp-internal => elisp}/ghc-pkg.el (100%) diff --git a/elisp-internal/ghc-mod-internal-pkg.el b/elisp-internal/ghc-mod-internal-pkg.el new file mode 100644 index 000000000..89307eb75 --- /dev/null +++ b/elisp-internal/ghc-mod-internal-pkg.el @@ -0,0 +1,5 @@ +(define-package + "ghc-mod-internal" + 2.0.0 + "Sub mode for Haskell mode" + '((haskell-mode "13.0"))) diff --git a/elisp-internal/ghc.el b/elisp-internal/ghc-mod-internal.el similarity index 84% rename from elisp-internal/ghc.el rename to elisp-internal/ghc-mod-internal.el index c15d53655..9071adb44 100644 --- a/elisp-internal/ghc.el +++ b/elisp-internal/ghc-mod-internal.el @@ -1,4 +1,4 @@ -;;; ghc.el --- ghc-mod front-end for haskell-mode +;;; ghc-mod-internal.el --- ghc-mod front-end for haskell-mode ;; Author: Kazu Yamamoto ;; Created: Sep 25, 2009 @@ -6,9 +6,9 @@ ;; 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))) +;; (autoload 'ghc-mod-internal-init "ghc" nil t) +;; (autoload 'ghc-mod-internal-debug "ghc" nil t) +;; (add-hook 'haskell-mode-hook (lambda () (ghc-mod-internal-init))) ;; ;; Or if you wish to display error each goto next/prev error, ;; set ghc-display-error valiable. @@ -28,7 +28,7 @@ (< emacs-minor-version minor))) (error "ghc-mod requires at least Emacs %d.%d" major minor))) -(defconst ghc-version "0") +(defconst ghc-mod-version "0") ;; (eval-when-compile ;; (require 'haskell-mode)) @@ -86,7 +86,7 @@ (defvar ghc-initialized nil) ;;;###autoload -(defun ghc-init () +(defun ghc-mod-internal-init () (ghc-abbrev-init) (ghc-type-init) (unless ghc-initialized @@ -125,28 +125,26 @@ (set (make-local-variable 'dabbrev-case-fold-search) nil)) ;;;###autoload -(defun ghc-debug () +(defun ghc-mod-internal-debug () (interactive) - (let ((el-path (locate-file "ghc.el" load-path)) + (let ((el-path (locate-file "ghc-mod-internal.el" load-path)) + (bootstrap-el-path (locate-file "ghc-mod.el" load-path)) (ghc-path (executable-find "ghc")) ;; FIXME (ghc-mod-path (executable-find ghc-module-command)) - (ghc-modi-path (executable-find ghc-interactive-command)) - (el-ver ghc-version) + (el-ver ghc-mod-version) (ghc-ver (ghc-run-ghc-mod '("--version") "ghc")) (ghc-mod-ver (ghc-run-ghc-mod '("version"))) - (ghc-modi-ver (ghc-run-ghc-mod '("version") ghc-interactive-command)) (path (getenv "PATH"))) (switch-to-buffer (get-buffer-create "**GHC Debug**")) (erase-buffer) (insert "Path: check if you are using intended programs.\n") - (insert (format "\t ghc.el path: %s\n" el-path)) - (insert (format "\t ghc-mod path: %s\n" ghc-mod-path)) - (insert (format "\tghc-modi path: %s\n" ghc-modi-path)) - (insert (format "\t ghc path: %s\n" ghc-path)) + (insert (format "\t ghc-mod.el path: %s\n" bootstrap-el-path)) + (insert (format "\t ghc-mod-internal.el path: %s\n" el-path)) + (insert (format "\t ghc-mod path: %s\n" ghc-mod-path)) + (insert (format "\t ghc path: %s\n" ghc-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)) + (insert (format "\tghc-mod-internal.el version %s\n" el-ver)) + (insert (format "\t %s\n" ghc-mod-ver)) (insert (format "\t%s\n" ghc-ver)) (insert "\nEnvironment variables:\n") (insert (format "\tPATH=%s\n" path)))) @@ -157,4 +155,4 @@ (ghc-initial-code-from-signature) (ghc-insert-template))) -(provide 'ghc) +(provide 'ghc-mod-internal) diff --git a/elisp/ghc-mod.el b/elisp/ghc-mod.el index 4bfa76838..be3da0f28 100644 --- a/elisp/ghc-mod.el +++ b/elisp/ghc-mod.el @@ -1,13 +1,42 @@ -(defconst ghc-version "0") +(defconst ghc-mod-version "0") (defvar ghc-module-command "ghc-mod" "*The command name of \"ghc-mod\"") (defvar ghc-bootstrapped nil) ;;;###autoload -(defun ghc-mod-init () +(defun ghc-mod-bootstrap () (unless ghc-bootstrapped (dolist (path (process-lines ghc-module-command "elispPath")) (add-to-list 'load-path path) - (setq ghc-bootstrapped t))) - (when (fboundp 'ghc-init) - (ghc-init))) + (require 'ghc-mod-internal) + (setq ghc-bootstrapped t)))) + +;;;###autoload +(defun ghc-mod-init () + (ghc-mod-bootstrap) + (when (fboundp 'ghc-mod-internal-init) + (ghc-mod-internal-init))) + +;;;###autoload +(defun ghc-mod-debug () + (condition-case err + (ghc-mod-bootstrap) + ('error + (interactive) + (switch-to-buffer (get-buffer-create "**GHC Debug**")) + (erase-buffer) + (insert "Error loading ghc-mod-internal. Check that ghc-mod is available on the PATH.\n") + (insert (format "Exception: %s\n" err)) + (insert (format "PATH: %s" (getenv "PATH"))))) + (when (fboundp 'ghc-mod-internal-debug) + (ghc-mod-internal-debug))) + +;;;###autoload +(defun ghc-init () + "Backwards compatible shim for ghc-mod-init" + (ghc-mod-init)) + +;;;###autoload +(defun ghc-debug () + "Backwards compatible shim for ghc-mod-debug" + (ghc-mod-debug)) diff --git a/elisp-internal/ghc-pkg.el b/elisp/ghc-pkg.el similarity index 100% rename from elisp-internal/ghc-pkg.el rename to elisp/ghc-pkg.el diff --git a/scripts/bump.sh b/scripts/bump.sh index 95ae485fe..d15ede894 100755 --- a/scripts/bump.sh +++ b/scripts/bump.sh @@ -14,11 +14,11 @@ fi cd $(dirname $0)/.. -sed -i 's/(defconst ghc-version ".*")/(defconst ghc-version "'"$VERSION"'")/' \ - elisp/ghc.el +sed -i 's/(defconst ghc-mod-version ".*")/(defconst ghc-mod-version "'"$VERSION"'")/' \ + elisp/ghc-mod.el -sed -i 's/(defconst ghc-version ".*")/(defconst ghc-version "'"$VERSION"'")/' \ - elisp-bootstrap/ghc-mod.el +sed -i 's/(defconst ghc-mod-version ".*")/(defconst ghc-mod-version "'"$VERSION"'")/' \ + elisp-internal/ghc-mod-internal.el sed -r -i 's/^(Version:[[:space:]]*)[0-9.]+/\1'"$VERSION"'/' ghc-mod.cabal