Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove haskell-interactive-mode-completion-cache #1119

Merged
merged 1 commit into from
Jan 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
(defvar haskell-interactive-mode-history (list))
(make-variable-buffer-local 'haskell-interactive-mode-history)

(defvar haskell-interactive-mode-completion-cache)
(make-variable-buffer-local 'haskell-interactive-mode-completion-cache)

(defvar haskell-interactive-mode-old-prompt-start
nil
"Mark used for the old beginning of the prompt.")
Expand Down Expand Up @@ -95,7 +92,6 @@ Key bindings:
:group 'haskell-interactive
(setq haskell-interactive-mode-history (list))
(setq haskell-interactive-mode-history-index 0)
(setq haskell-interactive-mode-completion-cache nil)

(setq next-error-function 'haskell-interactive-next-error-function)
(add-hook 'completion-at-point-functions
Expand Down Expand Up @@ -1002,17 +998,13 @@ don't care when the thing completes as long as it's soonish."
"Offer completions for partial expression between prompt and point"
(when (haskell-interactive-at-prompt)
(let* ((process (haskell-interactive-process))
(inp (haskell-interactive-mode-input-partial)))
(if (string= inp (car-safe haskell-interactive-mode-completion-cache))
(cdr haskell-interactive-mode-completion-cache)
(let* ((resp2 (haskell-process-get-repl-completions process inp))
(rlen (- (length inp) (length (car resp2))))
(coll (append (if (string-prefix-p inp "import") '("import"))
(if (string-prefix-p inp "let") '("let"))
(cdr resp2)))
(result (list (- (point) rlen) (point) coll)))
(setq haskell-interactive-mode-completion-cache (cons inp result))
result)))))
(inp (haskell-interactive-mode-input-partial))
(resp2 (haskell-process-get-repl-completions process inp))
(rlen (- (length inp) (length (car resp2))))
(coll (append (if (string-prefix-p inp "import") '("import"))
(if (string-prefix-p inp "let") '("let"))
(cdr resp2))))
(list (- (point) rlen) (point) coll))))

(defun haskell-interactive-mode-trigger-compile-error (state response)
"Look for an <interactive> compile error; if there is one, pop
Expand Down