From cc9be7b621643d00b87608b4a81832fc4ff1faf8 Mon Sep 17 00:00:00 2001 From: Chris Mears Date: Fri, 18 Sep 2015 08:44:36 +1000 Subject: [PATCH] Use :load *Module instead of touching files For reload-with-fbytecode, use ghci's ":load *" form to force interpretation instead of touching the file and hoping that :reload will notice. --- haskell-commands.el | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/haskell-commands.el b/haskell-commands.el index 553d738d0..aee0d67ba 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -143,29 +143,17 @@ If I break, you can: Restores -fobject-code after reload finished. MODULE-BUFFER is the actual Emacs buffer of the module being loaded." (haskell-process-queue-without-filters process ":set -fbyte-code") - (haskell-process-touch-buffer process module-buffer) - (haskell-process-queue-without-filters process ":reload") - (haskell-process-queue-without-filters process ":set -fobject-code")) - -;;;###autoload -(defun haskell-process-touch-buffer (process buffer) - "Query PROCESS to `:!touch` BUFFER's file. -Use to update mtime on BUFFER's file." - (interactive) - (haskell-process-queue-command + ;; We prefix the module's filename with a "*", which asks ghci to + ;; ignore any existing object file and interpret the module. + ;; Dependencies will still use their object files as usual. + (haskell-process-queue-without-filters process - (make-haskell-command - :state (cons process buffer) - :go (lambda (state) - (haskell-process-send-string - (car state) - (format ":!%s %s" - "touch" - (shell-quote-argument (buffer-file-name - (cdr state)))))) - :complete (lambda (state _) - (with-current-buffer (cdr state) - (clear-visited-file-modtime)))))) + (format ":load \"*%s\"" + (replace-regexp-in-string + "\"" + "\\\\\"" + (buffer-file-name module-buffer)))) + (haskell-process-queue-without-filters process ":set -fobject-code")) (defvar url-http-response-status) (defvar url-http-end-of-headers)