Skip to content

Commit

Permalink
Merge pull request #1863 from zaz/load-and-run-expr
Browse files Browse the repository at this point in the history
Load and run expr
  • Loading branch information
purcell authored Feb 9, 2025
2 parents 495fb96 + 238bb62 commit 8005478
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
(defvar interactive-haskell-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-l") 'haskell-process-load-file)
(define-key map (kbd "C-c RET") 'haskell-load-and-run) ;; == C-c C-m
(define-key map (kbd "C-c C-r") 'haskell-process-reload)
(define-key map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key map (kbd "C-c C-i") 'haskell-process-do-info)
Expand Down Expand Up @@ -397,6 +398,17 @@ Give optional NEXT-P parameter to override value of
nil
(current-buffer)))

(defvar haskell-load-and-run-expr-history nil
"History of expressions used in `haskell-load-and-run'.")

(defun haskell-load-and-run (expr)
"Load the current buffer and run EXPR, e.g. \"main\"."
(interactive (list (read-string "Run expression: "
(car haskell-load-and-run-expr-history)
'haskell-load-and-run-expr-history)))
(haskell-process-load-file)
(haskell-interactive-mode-run-expr expr))

;;;###autoload
(defun haskell-process-reload ()
"Re-load the current buffer file."
Expand Down

0 comments on commit 8005478

Please sign in to comment.