Merge commit '327451036dfab82ebe2020aa1757d92c6e5879bc'
This commit is contained in:
commit
393095005f
11
README.md
11
README.md
@ -28,11 +28,12 @@ package is called `ghc` there, not `ghc-mod`) and install the
|
|||||||
|
|
||||||
### Nix & NixOS
|
### Nix & NixOS
|
||||||
|
|
||||||
The installation is a little more involved in this environment as Nix needs some
|
`ghc-mod` works fine for users of Nix who follow a recent version of the
|
||||||
ugly hacks to get packages using the GHC API to work, please refer to this
|
package database such as the `nixos-15.09` or `nixos-unstable` channel. Just
|
||||||
stackoverflow answer:
|
include the package `ghc-mod` into your `ghcWithPackages` environment like any
|
||||||
|
other library. The [Nixpkgs Haskell User's
|
||||||
http://stackoverflow.com/a/24228830
|
Guide](http://hydra.nixos.org/job/nixpkgs/trunk/manual/latest/download-by-type/doc/manual#users-guide-to-the-haskell-infrastructure)
|
||||||
|
covers this subject in gret detail.
|
||||||
|
|
||||||
## Using the development version
|
## Using the development version
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
(let ((inhibit-field-text-motion t))
|
(let ((inhibit-field-text-motion t))
|
||||||
(sort-subr nil 'forward-line 'end-of-line
|
(sort-subr nil 'forward-line 'end-of-line
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(re-search-forward "^import\\( *qualified\\)? *" nil t)
|
(re-search-forward "^import +\\(qualified\\)? *" nil t)
|
||||||
nil)
|
nil)
|
||||||
'end-of-line))
|
'end-of-line))
|
||||||
(ghc-merge-lines))))
|
(ghc-merge-lines))))
|
||||||
@ -64,7 +64,7 @@
|
|||||||
(while (not (eolp))
|
(while (not (eolp))
|
||||||
;; qualified modlues are not merged at this moment.
|
;; qualified modlues are not merged at this moment.
|
||||||
;; fixme if it is improper.
|
;; fixme if it is improper.
|
||||||
(if (looking-at "^import *\\([A-Z][^ \n]+\\) *(\\(.*\\))$")
|
(if (looking-at "^import +\\([A-Z][^ \n]+\\) *(\\(.*\\))$")
|
||||||
(let ((mod (match-string-no-properties 1))
|
(let ((mod (match-string-no-properties 1))
|
||||||
(syms (match-string-no-properties 2))
|
(syms (match-string-no-properties 2))
|
||||||
(beg (point)))
|
(beg (point)))
|
||||||
@ -73,7 +73,7 @@
|
|||||||
(forward-line)))))
|
(forward-line)))))
|
||||||
|
|
||||||
(defun ghc-merge-line (beg mod syms)
|
(defun ghc-merge-line (beg mod syms)
|
||||||
(let ((regex (concat "^import *" (regexp-quote mod) " *(\\(.*\\))$"))
|
(let ((regex (concat "^import +" (regexp-quote mod) " *(\\(.*\\))$"))
|
||||||
duplicated)
|
duplicated)
|
||||||
(while (looking-at regex)
|
(while (looking-at regex)
|
||||||
(setq duplicated t)
|
(setq duplicated t)
|
||||||
|
@ -265,7 +265,7 @@ unloaded modules are loaded")
|
|||||||
(let (ret)
|
(let (ret)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^import\\( *qualified\\)? +\\([^\n ]+\\)" nil t)
|
(while (re-search-forward "^import +\\(qualified\\)? *\\([^\n ]+\\)" nil t)
|
||||||
(ghc-add ret (match-string-no-properties 2))
|
(ghc-add ret (match-string-no-properties 2))
|
||||||
(forward-line)))
|
(forward-line)))
|
||||||
ret))
|
ret))
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
(defun ghc-goto-module-position ()
|
(defun ghc-goto-module-position ()
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(if (re-search-backward "^import" nil t)
|
(if (re-search-backward "^import +" nil t)
|
||||||
(ghc-goto-empty-line)
|
(ghc-goto-empty-line)
|
||||||
(if (not (re-search-backward "^module" nil t))
|
(if (not (re-search-backward "^module" nil t))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
@ -138,7 +138,8 @@
|
|||||||
(el-ver ghc-version)
|
(el-ver ghc-version)
|
||||||
(ghc-ver (ghc-run-ghc-mod '("--version") "ghc"))
|
(ghc-ver (ghc-run-ghc-mod '("--version") "ghc"))
|
||||||
(ghc-mod-ver (ghc-run-ghc-mod '("version")))
|
(ghc-mod-ver (ghc-run-ghc-mod '("version")))
|
||||||
(path (getenv "PATH")))
|
(path (getenv "PATH"))
|
||||||
|
(debug (ghc-run-ghc-mod '("debug")))) ;; before switching buffers.
|
||||||
(switch-to-buffer (get-buffer-create "**GHC Debug**"))
|
(switch-to-buffer (get-buffer-create "**GHC Debug**"))
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(insert "Path: check if you are using intended programs.\n")
|
(insert "Path: check if you are using intended programs.\n")
|
||||||
@ -150,7 +151,10 @@
|
|||||||
(insert (format "\t %s\n" ghc-mod-ver))
|
(insert (format "\t %s\n" ghc-mod-ver))
|
||||||
(insert (format "\t%s\n" ghc-ver))
|
(insert (format "\t%s\n" ghc-ver))
|
||||||
(insert "\nEnvironment variables:\n")
|
(insert "\nEnvironment variables:\n")
|
||||||
(insert (format "\tPATH=%s\n" path))))
|
(insert (format "\tPATH=%s\n" path))
|
||||||
|
(insert "\nThe result of \"ghc-mod debug\":\n")
|
||||||
|
(insert debug)
|
||||||
|
(goto-char (point-min))))
|
||||||
|
|
||||||
(defun ghc-insert-template-or-signature (&optional flag)
|
(defun ghc-insert-template-or-signature (&optional flag)
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
|
Loading…
Reference in New Issue
Block a user