Skip to content

Commit cc9be7b

Browse files
committed
Use :load *Module instead of touching files
For reload-with-fbytecode, use ghci's ":load *<file>" form to force interpretation instead of touching the file and hoping that :reload will notice.
1 parent 513d589 commit cc9be7b

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

haskell-commands.el

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -143,29 +143,17 @@ If I break, you can:
143143
Restores -fobject-code after reload finished.
144144
MODULE-BUFFER is the actual Emacs buffer of the module being loaded."
145145
(haskell-process-queue-without-filters process ":set -fbyte-code")
146-
(haskell-process-touch-buffer process module-buffer)
147-
(haskell-process-queue-without-filters process ":reload")
148-
(haskell-process-queue-without-filters process ":set -fobject-code"))
149-
150-
;;;###autoload
151-
(defun haskell-process-touch-buffer (process buffer)
152-
"Query PROCESS to `:!touch` BUFFER's file.
153-
Use to update mtime on BUFFER's file."
154-
(interactive)
155-
(haskell-process-queue-command
146+
;; We prefix the module's filename with a "*", which asks ghci to
147+
;; ignore any existing object file and interpret the module.
148+
;; Dependencies will still use their object files as usual.
149+
(haskell-process-queue-without-filters
156150
process
157-
(make-haskell-command
158-
:state (cons process buffer)
159-
:go (lambda (state)
160-
(haskell-process-send-string
161-
(car state)
162-
(format ":!%s %s"
163-
"touch"
164-
(shell-quote-argument (buffer-file-name
165-
(cdr state))))))
166-
:complete (lambda (state _)
167-
(with-current-buffer (cdr state)
168-
(clear-visited-file-modtime))))))
151+
(format ":load \"*%s\""
152+
(replace-regexp-in-string
153+
"\""
154+
"\\\\\""
155+
(buffer-file-name module-buffer))))
156+
(haskell-process-queue-without-filters process ":set -fobject-code"))
169157

170158
(defvar url-http-response-status)
171159
(defvar url-http-end-of-headers)

0 commit comments

Comments
 (0)