diff --git a/haskell-load.el b/haskell-load.el index 4bd622d21..f9834a3be 100644 --- a/haskell-load.el +++ b/haskell-load.el @@ -1,6 +1,7 @@ ;;; haskell-load.el --- Compiling and loading modules in the GHCi process -*- lexical-binding: t -*- -;; Copyright (c) 2014 Chris Done. All rights reserved. +;; Copyright © 2014 Chris Done. All rights reserved. +;; 2016 Arthur Fayzrakhmanov ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -15,6 +16,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . +;;; Commentary: + ;;; Code: (require 'cl-lib) @@ -31,52 +34,55 @@ changed. Restarts the process if that is the case." (new-checksum (haskell-cabal-compute-checksum (haskell-session-get session 'cabal-dir)))) (when (not (string= current-checksum new-checksum)) - (haskell-interactive-mode-echo session (format "Cabal file changed: %s" new-checksum)) - (haskell-session-set-cabal-checksum session - (haskell-session-get session 'cabal-dir)) - (unless (and haskell-process-prompt-restart-on-cabal-change - (not (y-or-n-p "Cabal file changed; restart GHCi process? "))) + (haskell-interactive-mode-echo + session + (format "Cabal file changed: %s" new-checksum)) + (haskell-session-set-cabal-checksum + session + (haskell-session-get session 'cabal-dir)) + (unless + (and haskell-process-prompt-restart-on-cabal-change + (not (y-or-n-p "Cabal file changed; restart GHCi process? "))) (haskell-process-start (haskell-interactive-session)))))) (defun haskell-process-live-build (process buffer echo-in-repl) "Show live updates for loading files." - (cond ((haskell-process-consume - process - (concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]" - " Compiling \\([^ ]+\\)[ ]+" - "( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+")) - (haskell-process-echo-load-message process buffer echo-in-repl nil) - t) - ((haskell-process-consume - process - (concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]" - " Compiling \\[TH\\] \\([^ ]+\\)[ ]+" - "( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+")) - (haskell-process-echo-load-message process buffer echo-in-repl t) - t) - ((haskell-process-consume process "Loading package \\([^ ]+\\) ... linking ... done.\n") - (haskell-mode-message-line - (format "Loading: %s" - (match-string 1 buffer))) - t) - ((haskell-process-consume - process - "^Preprocessing executables for \\(.+?\\)\\.\\.\\.") - (let ((msg (format "Preprocessing: %s" (match-string 1 buffer)))) - (haskell-interactive-mode-echo - (haskell-process-session process) - msg) - (haskell-mode-message-line msg))) - ((haskell-process-consume process "Linking \\(.+?\\) \\.\\.\\.") - (let ((msg (format "Linking: %s" (match-string 1 buffer)))) - (haskell-interactive-mode-echo (haskell-process-session process) msg) - (haskell-mode-message-line msg))) - ((haskell-process-consume process "\nBuilding \\(.+?\\)\\.\\.\\.") - (let ((msg (format "Building: %s" (match-string 1 buffer)))) - (haskell-interactive-mode-echo - (haskell-process-session process) - msg) - (haskell-mode-message-line msg))))) + (cond + ((haskell-process-consume + process + (concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]" + " Compiling \\([^ ]+\\)[ ]+" + "( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+")) + (haskell-process-echo-load-message process buffer echo-in-repl nil) + t) + ((haskell-process-consume + process + (concat "\\[[ ]*\\([0-9]+\\) of \\([0-9]+\\)\\]" + " Compiling \\[TH\\] \\([^ ]+\\)[ ]+" + "( \\([^ ]+\\), \\([^ ]+\\) )[^\r\n]*[\r\n]+")) + (haskell-process-echo-load-message process buffer echo-in-repl t) + t) + ((haskell-process-consume + process + "Loading package \\([^ ]+\\) ... linking ... done.\n") + (haskell-mode-message-line + (format "Loading: %s" + (match-string 1 buffer))) + t) + ((haskell-process-consume + process + "^Preprocessing executables for \\(.+?\\)\\.\\.\\.") + (let ((msg (format "Preprocessing: %s" (match-string 1 buffer)))) + (haskell-interactive-mode-echo (haskell-process-session process) msg) + (haskell-mode-message-line msg))) + ((haskell-process-consume process "Linking \\(.+?\\) \\.\\.\\.") + (let ((msg (format "Linking: %s" (match-string 1 buffer)))) + (haskell-interactive-mode-echo (haskell-process-session process) msg) + (haskell-mode-message-line msg))) + ((haskell-process-consume process "\nBuilding \\(.+?\\)\\.\\.\\.") + (let ((msg (format "Building: %s" (match-string 1 buffer)))) + (haskell-interactive-mode-echo (haskell-process-session process) msg) + (haskell-mode-message-line msg))))) (defun haskell-process-load-complete (session process buffer reload module-buffer &optional cont) "Handle the complete loading response. BUFFER is the string of @@ -85,29 +91,38 @@ actual Emacs buffer of the module being loaded." (when (get-buffer (format "*%s:splices*" (haskell-session-name session))) (with-current-buffer (haskell-interactive-mode-splices-buffer session) (erase-buffer))) - (let* ((ok (cond ((haskell-process-consume process "Ok, modules loaded: \\(.+\\)\\.$") t) - ((haskell-process-consume process "Failed, modules loaded: \\(.+\\)\\.$") nil) - (t (error (message "Unexpected response from haskell process."))))) - (modules (haskell-process-extract-modules buffer)) - (cursor (haskell-process-response-cursor process)) - (warning-count 0)) + (let* ((ok (cond + ((haskell-process-consume + process + "Ok, modules loaded: \\(.+\\)\\.$") + t) + ((haskell-process-consume + process + "Failed, modules loaded: \\(.+\\)\\.$") + nil) + (t + (error (message "Unexpected response from haskell process."))))) + (modules (haskell-process-extract-modules buffer)) + (cursor (haskell-process-response-cursor process)) + (warning-count 0)) (haskell-process-set-response-cursor process 0) (haskell-check-remove-overlays module-buffer) - (while (haskell-process-errors-warnings module-buffer session process buffer) + (while + (haskell-process-errors-warnings module-buffer session process buffer) (setq warning-count (1+ warning-count))) (haskell-process-set-response-cursor process cursor) (if (and (not reload) - haskell-process-reload-with-fbytecode) - (haskell-process-reload-with-fbytecode process module-buffer) - (haskell-process-import-modules process (car modules))) + haskell-process-reload-with-fbytecode) + (haskell-process-reload-with-fbytecode process module-buffer) + (haskell-process-import-modules process (car modules))) (if ok - (haskell-mode-message-line (if reload "Reloaded OK." "OK.")) - (haskell-interactive-mode-compile-error session "Compilation failed.")) + (haskell-mode-message-line (if reload "Reloaded OK." "OK.")) + (haskell-interactive-mode-compile-error session "Compilation failed.")) (when cont (condition-case e - (funcall cont ok) - (error (message "%S" e)) - (quit nil))))) + (funcall cont ok) + (error (message "%S" e)) + (quit nil))))) (defun haskell-process-suggest-imports (session file modules ident) "Given a list of MODULES, suggest adding them to the import section." @@ -116,18 +131,25 @@ actual Emacs buffer of the module being loaded." (cl-assert ident) (let* ((process (haskell-session-process session)) (suggested-already (haskell-process-suggested-imports process)) - (module (cond ((> (length modules) 1) - (when (y-or-n-p (format "Identifier `%s' not in scope, choose module to import?" - ident)) - (haskell-complete-module-read "Module: " modules))) - ((= (length modules) 1) - (let ((module (car modules))) - (unless (member module suggested-already) - (haskell-process-set-suggested-imports process (cons module suggested-already)) - (when (y-or-n-p (format "Identifier `%s' not in scope, import `%s'?" - ident - module)) - module))))))) + (module + (cond + ((> (length modules) 1) + (when (y-or-n-p + (format + "Identifier `%s' not in scope, choose module to import?" + ident)) + (haskell-complete-module-read "Module: " modules))) + ((= (length modules) 1) + (let ((module (car modules))) + (unless (member module suggested-already) + (haskell-process-set-suggested-imports + process + (cons module suggested-already)) + (when (y-or-n-p + (format "Identifier `%s' not in scope, import `%s'?" + ident + module)) + module))))))) (when module (haskell-process-find-file session file) (haskell-add-import module)))) @@ -135,28 +157,44 @@ actual Emacs buffer of the module being loaded." (defun haskell-process-trigger-suggestions (session msg file line) "Trigger prompting to add any extension suggestions." (cond ((let ((case-fold-search nil)) - (or (and (string-match " -X\\([A-Z][A-Za-z]+\\)" msg) - (not (string-match "\\([A-Z][A-Za-z]+\\) is deprecated" msg))) - (string-match "Use \\([A-Z][A-Za-z]+\\) to permit this" msg) - (string-match "Use \\([A-Z][A-Za-z]+\\) to allow" msg) - (string-match "Use \\([A-Z][A-Za-z]+\\) if you want to disable this" msg) - (string-match "use \\([A-Z][A-Za-z]+\\)" msg) - (string-match "You need \\([A-Z][A-Za-z]+\\)" msg))) + (or + (and (string-match " -X\\([A-Z][A-Za-z]+\\)" msg) + (not (string-match "\\([A-Z][A-Za-z]+\\) is deprecated" msg))) + (string-match "Use \\([A-Z][A-Za-z]+\\) to permit this" msg) + (string-match "Use \\([A-Z][A-Za-z]+\\) to allow" msg) + (string-match + "Use \\([A-Z][A-Za-z]+\\) if you want to disable this" + msg) + (string-match "use \\([A-Z][A-Za-z]+\\)" msg) + (string-match "You need \\([A-Z][A-Za-z]+\\)" msg))) (when haskell-process-suggest-language-pragmas - (haskell-process-suggest-pragma session "LANGUAGE" (match-string 1 msg) file))) - ((string-match " The \\(qualified \\)?import of[ ][‘`‛]\\([^ ]+\\)['’] is redundant" msg) + (haskell-process-suggest-pragma + session + "LANGUAGE" + (match-string 1 msg) + file))) + ((string-match + " The \\(qualified \\)?import of[ ][‘`‛]\\([^ ]+\\)['’] is redundant" + msg) (when haskell-process-suggest-remove-import-lines - (haskell-process-suggest-remove-import session - file - (match-string 2 msg) - line))) + (haskell-process-suggest-remove-import + session + file + (match-string 2 msg) + line))) ((string-match "Warning: orphan instance: " msg) (when haskell-process-suggest-no-warn-orphans - (haskell-process-suggest-pragma session "OPTIONS" "-fno-warn-orphans" file))) + (haskell-process-suggest-pragma + session + "OPTIONS" "-fno-warn-orphans" + file))) ((or (string-match "against inferred type [‘`‛]\\[Char\\]['’]" msg) (string-match "with actual type [‘`‛]\\[Char\\]['’]" msg)) (when haskell-process-suggest-overloaded-strings - (haskell-process-suggest-pragma session "LANGUAGE" "OverloadedStrings" file))) + (haskell-process-suggest-pragma + session + "LANGUAGE" "OverloadedStrings" + file))) ((string-match "^Not in scope: .*[‘`‛]\\(.+\\)['’]$" msg) (let* ((match1 (match-string 1 msg)) (ident (if (string-match "^[A-Za-z0-9_'.]+\\.\\(.+\\)$" match1) @@ -191,7 +229,6 @@ actual Emacs buffer of the module being loaded." process (make-haskell-command :state (list (haskell-interactive-session) process command 0) - :go (lambda (state) (haskell-process-send-string @@ -205,7 +242,6 @@ actual Emacs buffer of the module being loaded." ('cabal-ghci haskell-process-path-cabal) ('stack-ghci haskell-process-path-stack)) (cl-caddr state))))) - :live (lambda (state buffer) (let ((cmd (replace-regexp-in-string "^\\([a-z]+\\).*" @@ -216,14 +252,13 @@ actual Emacs buffer of the module being loaded." (haskell-process-live-build (cadr state) buffer t)) (t (haskell-process-cabal-live state buffer))))) - :complete (lambda (state response) (let* ((process (cadr state)) (session (haskell-process-session process)) (message-count 0) (cursor (haskell-process-response-cursor process))) - ;; XXX: what the hell about the rampant code duplication? + ;; XXX: what the hell about the rampant code duplication? (haskell-process-set-response-cursor process 0) (while (haskell-process-errors-warnings nil session process response) (setq message-count (1+ message-count))) @@ -315,7 +350,7 @@ actual Emacs buffer of the module being loaded." correspondingly-named overlay properties of OVL." (let ((ovlvar (cl-gensym "OVL-"))) `(let* ((,ovlvar ,ovl) - ,@(mapcar (lambda (p) `(,p (overlay-get ,ovlvar ',p))) proplist)) + ,@(mapcar (lambda (p) `(,p (overlay-get ,ovlvar ',p))) proplist)) ,@body))) (defun overlay-start> (o1 o2) @@ -332,19 +367,24 @@ correspondingly-named overlay properties of OVL." (cl-first (sort (cl-copy-list ovls) 'overlay-start>)))) (defun haskell-error-overlay-briefly (ovl) - (with-overlay-properties (haskell-msg haskell-msg-type) ovl - (cond ((not (eq haskell-msg-type 'warning)) - haskell-msg) - ((string-prefix-p "Warning:\n " haskell-msg) - (cl-subseq haskell-msg 13)) - (t (error "Invariant failed: a warning message from GHC has unexpected form: %s." haskell-msg))))) + (with-overlay-properties + (haskell-msg haskell-msg-type) ovl + (cond + ((not (eq haskell-msg-type 'warning)) + haskell-msg) + ((string-prefix-p "Warning:\n " haskell-msg) + (cl-subseq haskell-msg 13)) + (t + (error + "Invariant failed: a warning message from GHC has unexpected form: %s." + haskell-msg))))) (defun haskell-goto-error-overlay (ovl) (cond (ovl - (goto-char (overlay-start ovl)) - (haskell-mode-message-line (haskell-error-overlay-briefly ovl))) - (t - (message "No further notes from Haskell compiler.")))) + (goto-char (overlay-start ovl)) + (haskell-mode-message-line (haskell-error-overlay-briefly ovl))) + (t + (message "No further notes from Haskell compiler.")))) (defun haskell-goto-first-error () (interactive) @@ -355,124 +395,141 @@ correspondingly-named overlay properties of OVL." (defun haskell-goto-prev-error () (interactive) (haskell-goto-error-overlay - (let ((ovl-at (cl-first (haskell-check-filter-overlays (overlays-at (point)))))) + (let ((ovl-at + (cl-first (haskell-check-filter-overlays (overlays-at (point)))))) (or (last-overlay-in-if 'haskell-check-overlay-p - (point-min) (if ovl-at (overlay-start ovl-at) (point))) - ovl-at)))) + (point-min) + (if ovl-at (overlay-start ovl-at) (point))) + ovl-at)))) (defun haskell-goto-next-error () (interactive) (haskell-goto-error-overlay - (let ((ovl-at (cl-first (haskell-check-filter-overlays (overlays-at (point)))))) - (or (first-overlay-in-if 'haskell-check-overlay-p - (if ovl-at (overlay-end ovl-at) (point)) (point-max)) - ovl-at)))) - -(defun haskell-check-paint-overlay (buffer error-from-this-file-p line msg file type hole coln) + (let ((ovl-at + (cl-first (haskell-check-filter-overlays (overlays-at (point)))))) + (or (first-overlay-in-if + 'haskell-check-overlay-p + (if ovl-at (overlay-end ovl-at) (point)) (point-max)) + ovl-at)))) + +(defun haskell-check-paint-overlay + (buffer error-from-this-file-p line msg file type hole coln) (with-current-buffer buffer (let (beg end) (goto-char (point-min)) - ;; XXX: we can avoid excess buffer walking by relying on the maybe-fact that - ;; GHC sorts error messages by line number, maybe. + ;; XXX: we can avoid excess buffer walking by relying on the maybe-fact + ;; that GHC sorts error messages by line number, maybe. (cond - (error-from-this-file-p - (forward-line (1- line)) - (forward-char (1- coln)) - (setq beg (point)) - (if (eq type 'hole) - (forward-char (length hole)) - (skip-chars-forward "^[:space:]" (line-end-position))) - (setq end (point))) - (t - (setq beg (point)) - (forward-line) - (setq end (point)))) + (error-from-this-file-p + (forward-line (1- line)) + (forward-char (1- coln)) + (setq beg (point)) + (if (eq type 'hole) + (forward-char (length hole)) + (skip-chars-forward "^[:space:]" (line-end-position))) + (setq end (point))) + (t + (setq beg (point)) + (forward-line) + (setq end (point)))) (let ((ovl (make-overlay beg end))) - (overlay-put ovl 'haskell-check t) - (overlay-put ovl 'haskell-file file) - (overlay-put ovl 'haskell-msg msg) - (overlay-put ovl 'haskell-msg-type type) - (overlay-put ovl 'help-echo msg) - (overlay-put ovl 'haskell-hole hole) - (cl-destructuring-bind (face fringe) (cl-case type - (warning (list 'haskell-warning-face haskell-check-warning-fringe)) - (hole (list 'haskell-hole-face haskell-check-hole-fringe)) - (error (list 'haskell-error-face haskell-check-error-fringe))) - (overlay-put ovl 'before-string fringe) - (overlay-put ovl 'face face)))))) - -(defun haskell-process-errors-warnings (module-buffer session process buffer &optional return-only) - "Trigger handling type errors or warnings. Either prints the -messages in the interactive buffer or if CONT is specified, -passes the error onto that. + (overlay-put ovl 'haskell-check t) + (overlay-put ovl 'haskell-file file) + (overlay-put ovl 'haskell-msg msg) + (overlay-put ovl 'haskell-msg-type type) + (overlay-put ovl 'help-echo msg) + (overlay-put ovl 'haskell-hole hole) + (cl-destructuring-bind + (face fringe) + (cl-case type + (warning + (list 'haskell-warning-face haskell-check-warning-fringe)) + (hole + (list 'haskell-hole-face haskell-check-hole-fringe)) + (error + (list 'haskell-error-face haskell-check-error-fringe))) + (overlay-put ovl 'before-string fringe) + (overlay-put ovl 'face face)))))) + +(defun haskell-process-errors-warnings + (module-buffer session process buffer &optional return-only) + "Trigger handling type errors or warnings. +Either prints the messages in the interactive buffer or if CONT +is specified, passes the error onto that. When MODULE-BUFFER is non-NIL, paint error overlays." (save-excursion (cond - ((haskell-process-consume - process - "\\(Module imports form a cycle:[ \n]+module [^ ]+ ([^)]+)[[:unibyte:][:nonascii:]]+?\\)\nFailed") - (let ((err (match-string 1 buffer))) - (if (string-match "module [`'‘‛]\\([^ ]+\\)['’`] (\\([^)]+\\))" err) - (let* ((default-directory (haskell-session-current-dir session)) - (module (match-string 1 err)) - (file (match-string 2 err)) - (relative-file-name (file-relative-name file))) - (unless return-only - (haskell-interactive-show-load-message - session - 'import-cycle - module - relative-file-name - nil - nil) - (haskell-interactive-mode-compile-error - session - (format "%s:1:0: %s" - relative-file-name - err))) - (list :file file :line 1 :col 0 :msg err :type 'error)) - t))) - ((haskell-process-consume - process - (concat "[\r\n]\\([A-Z]?:?[^ \r\n:][^:\n\r]+\\):\\([0-9()-:]+\\):" - "[ \n\r]+\\([[:unibyte:][:nonascii:]]+?\\)\n[^ ]")) - (haskell-process-set-response-cursor process - (- (haskell-process-response-cursor process) 1)) - (let* ((buffer (haskell-process-response process)) - (file (match-string 1 buffer)) - (location-raw (match-string 2 buffer)) - (error-msg (match-string 3 buffer)) - (type (cond ((string-match "^Warning:" error-msg) 'warning) - ((string-match "^Splicing " error-msg) 'splice) - (t 'error))) - (critical (not (eq type 'warning))) - ;; XXX: extract hole information, pass down to `haskell-check-paint-overlay' - (final-msg (format "%s:%s: %s" - (haskell-session-strip-dir session file) - location-raw - error-msg)) - (location (haskell-process-parse-error (concat file ":" location-raw ": x"))) - (line (plist-get location :line)) - (col1 (plist-get location :col))) - (when module-buffer - (haskell-check-paint-overlay module-buffer (string= (file-truename (buffer-file-name module-buffer)) (file-truename file)) - line error-msg file type nil col1)) - (if return-only - (list :file file :line line :col col1 :msg error-msg :type type) - (progn (funcall (cl-case type - (warning 'haskell-interactive-mode-compile-warning) - (splice 'haskell-interactive-mode-compile-splice) - (error 'haskell-interactive-mode-compile-error)) - session final-msg) - (when critical - (haskell-mode-message-line final-msg)) - (haskell-process-trigger-suggestions - session - error-msg - file - (plist-get (haskell-process-parse-error final-msg) :line)) - t))))))) + ((haskell-process-consume + process + "\\(Module imports form a cycle:[ \n]+module [^ ]+ ([^)]+)[[:unibyte:][:nonascii:]]+?\\)\nFailed") + (let ((err (match-string 1 buffer))) + (if (string-match "module [`'‘‛]\\([^ ]+\\)['’`] (\\([^)]+\\))" err) + (let* ((default-directory (haskell-session-current-dir session)) + (module (match-string 1 err)) + (file (match-string 2 err)) + (relative-file-name (file-relative-name file))) + (unless return-only + (haskell-interactive-show-load-message + session + 'import-cycle + module + relative-file-name + nil + nil) + (haskell-interactive-mode-compile-error + session + (format "%s:1:0: %s" + relative-file-name + err))) + (list :file file :line 1 :col 0 :msg err :type 'error)) + t))) + ((haskell-process-consume + process + (concat "[\r\n]\\([A-Z]?:?[^ \r\n:][^:\n\r]+\\):\\([0-9()-:]+\\):" + "[ \n\r]+\\([[:unibyte:][:nonascii:]]+?\\)\n[^ ]")) + (haskell-process-set-response-cursor + process + (- (haskell-process-response-cursor process) 1)) + (let* ((buffer (haskell-process-response process)) + (file (match-string 1 buffer)) + (location-raw (match-string 2 buffer)) + (error-msg (match-string 3 buffer)) + (type (cond ((string-match "^Warning:" error-msg) 'warning) + ((string-match "^Splicing " error-msg) 'splice) + (t 'error))) + (critical (not (eq type 'warning))) + ;; XXX: extract hole information, pass down to + ;; `haskell-check-paint-overlay' + (final-msg (format "%s:%s: %s" + (haskell-session-strip-dir session file) + location-raw + error-msg)) + (location (haskell-process-parse-error + (concat file ":" location-raw ": x"))) + (line (plist-get location :line)) + (col1 (plist-get location :col))) + (when module-buffer + (haskell-check-paint-overlay + module-buffer + (string= (file-truename (buffer-file-name module-buffer)) + (file-truename file)) + line error-msg file type nil col1)) + (if return-only + (list :file file :line line :col col1 :msg error-msg :type type) + (progn (funcall (cl-case type + (warning 'haskell-interactive-mode-compile-warning) + (splice 'haskell-interactive-mode-compile-splice) + (error 'haskell-interactive-mode-compile-error)) + session final-msg) + (when critical + (haskell-mode-message-line final-msg)) + (haskell-process-trigger-suggestions + session + error-msg + file + (plist-get (haskell-process-parse-error final-msg) :line)) + t))))))) (defun haskell-interactive-show-load-message (session type module-name file-name echo th) "Show the '(Compiling|Loading) X' message." @@ -483,7 +540,8 @@ When MODULE-BUFFER is non-NIL, paint error overlays." (format "Compiling: %s (%s)" module-name file-name) (format "Compiling: %s" module-name))) ('loading (format "Loading: %s" module-name)) - ('import-cycle (format "Module has an import cycle: %s" module-name))) + ('import-cycle + (format "Module has an import cycle: %s" module-name))) (if th " [TH]" "")))) (haskell-mode-message-line msg) (when haskell-interactive-mode-delete-superseded-errors @@ -493,17 +551,20 @@ When MODULE-BUFFER is non-NIL, paint error overlays." ;;;###autoload (defun haskell-process-reload-devel-main () - "Reload the module `DevelMain' and then run -`DevelMain.update'. This is for doing live update of the code of -servers or GUI applications. Put your development version of the -program in `DevelMain', and define `update' to auto-start the -program on a new thread, and use the `foreign-store' package to -access the running context across :load/:reloads in GHCi." + "Reload the module `DevelMain' and then run `DevelMain.update'. + +This is for doing live update of the code of servers or GUI +applications. Put your development version of the program in +`DevelMain', and define `update' to auto-start the program on a +new thread, and use the `foreign-store' package to access the +running context across :load/:reloads in GHCi." (interactive) - (with-current-buffer (or (get-buffer "DevelMain.hs") - (if (y-or-n-p "You need to open a buffer named DevelMain.hs. Find now?") - (ido-find-file) - (error "No DevelMain.hs buffer."))) + (with-current-buffer + (or (get-buffer "DevelMain.hs") + (if (y-or-n-p + "You need to open a buffer named DevelMain.hs. Find now?") + (ido-find-file) + (error "No DevelMain.hs buffer."))) (let ((session (haskell-interactive-session))) (let ((process (haskell-interactive-process))) (haskell-process-queue-command @@ -534,3 +595,4 @@ access the running context across :load/:reloads in GHCi." (message "DevelMain updated."))))))))))) (provide 'haskell-load) +;;; haskell-load.el ends here